Discussion:
Help for VPN to TCP/IP Socket, in C#.NET
(too old to reply)
chris_dev
2007-03-29 17:50:01 UTC
Permalink
1. My C# app successfully connects to another machine on my LAN.
2. I have successfully opened a VPN connection to a remote machine (3 miles
away).
3. I'm unable to connect to that remote machine's Socket (given an IP
Address and a Port).

Any ideas? I've used both the Socket and TcpClient classes.

Here is a code snippet (using a TcpClient):

[Code]
using System;
using System.Text;
using System.Net.Sockets;
using System.Threading;

namespace SimpleTCPClient
{
class cApplication
{
/* NetworkStream that will be used */
private static NetworkStream myStream;
/* TcpClient that will connect */
private static TcpClient myClient;
/* Storage space */
private static byte[] myBuffer;
/* Application running flag */
private static bool bActive = true;

/* Entry point */
static void Main(string[] args)
{
Console.Write("Enter server name/address: ");
String strServer = Console.ReadLine();

Console.Write("Enter remote port: ");
String strPort = Console.ReadLine();

/* Connecting to server (will crash if address/name is
incorrect) */
myClient = new TcpClient(strServer, Int32.Parse(strPort));
Console.WriteLine("Connected...");
}
}
[/Code]

Many thanks for any help,
Sincerely,

Chris.
Uncle Marvo
2007-03-30 08:04:39 UTC
Permalink
Just a simple thought - can you (in the command line) TELNET ipaddr port?
Post by chris_dev
1. My C# app successfully connects to another machine on my LAN.
2. I have successfully opened a VPN connection to a remote machine
(3 miles away).
3. I'm unable to connect to that remote machine's Socket (given an IP
Address and a Port).
Any ideas? I've used both the Socket and TcpClient classes.
[Code]
using System;
using System.Text;
using System.Net.Sockets;
using System.Threading;
namespace SimpleTCPClient
{
class cApplication
{
/* NetworkStream that will be used */
private static NetworkStream myStream;
/* TcpClient that will connect */
private static TcpClient myClient;
/* Storage space */
private static byte[] myBuffer;
/* Application running flag */
private static bool bActive = true;
/* Entry point */
static void Main(string[] args)
{
Console.Write("Enter server name/address: ");
String strServer = Console.ReadLine();
Console.Write("Enter remote port: ");
String strPort = Console.ReadLine();
/* Connecting to server (will crash if address/name is
incorrect) */
myClient = new TcpClient(strServer, Int32.Parse(strPort));
Console.WriteLine("Connected...");
}
}
[/Code]
Many thanks for any help,
Sincerely,
Chris.
chris_dev
2007-03-30 16:38:04 UTC
Permalink
Thank you Uncle Marvo. At least I'm 1 step closer to solving this!

After using C:/TELNET 192.169.1.121 7000, I received this error:

"Could not open connection to the Host on Port 7000: Connect failed."

I'm wondering if the remote host has a security layer I don't know about.

I'll keep working on this.

Thanks for any more suggestions,
Sincerely,

Chris.
Post by Uncle Marvo
Just a simple thought - can you (in the command line) TELNET ipaddr port?
Post by chris_dev
1. My C# app successfully connects to another machine on my LAN.
2. I have successfully opened a VPN connection to a remote machine
(3 miles away).
3. I'm unable to connect to that remote machine's Socket (given an IP
Address and a Port).
Any ideas? I've used both the Socket and TcpClient classes.
[Code]
using System;
using System.Text;
using System.Net.Sockets;
using System.Threading;
namespace SimpleTCPClient
{
class cApplication
{
/* NetworkStream that will be used */
private static NetworkStream myStream;
/* TcpClient that will connect */
private static TcpClient myClient;
/* Storage space */
private static byte[] myBuffer;
/* Application running flag */
private static bool bActive = true;
/* Entry point */
static void Main(string[] args)
{
Console.Write("Enter server name/address: ");
String strServer = Console.ReadLine();
Console.Write("Enter remote port: ");
String strPort = Console.ReadLine();
/* Connecting to server (will crash if address/name is
incorrect) */
myClient = new TcpClient(strServer, Int32.Parse(strPort));
Console.WriteLine("Connected...");
}
}
[/Code]
Many thanks for any help,
Sincerely,
Chris.
Uncle Marvo
2007-04-02 09:47:52 UTC
Permalink
Post by chris_dev
Thank you Uncle Marvo. At least I'm 1 step closer to solving this!
"Could not open connection to the Host on Port 7000: Connect failed."
I'm wondering if the remote host has a security layer I don't know about.
Might well be the Windows XP SP2 firewall or another like Symantec, Panda,
whatever? Turn it off and check it again.

Either that or there is no listener on port 7000 on the remote machine?
What's meant to be listening?
chris_dev
2007-04-02 16:48:03 UTC
Permalink
Yes. It appears there is some sort of Firewall/Security on the remote host
(that they didn't know about!). After asking them to double-check the Port,
they discovered a hardware router was not letting traffic through.

I'm working on getting it removed, or otherwise accessible, to my Client.
Should be working by this afternoon.

Many thanks for your help!

Chris.
Post by Uncle Marvo
Post by chris_dev
Thank you Uncle Marvo. At least I'm 1 step closer to solving this!
"Could not open connection to the Host on Port 7000: Connect failed."
I'm wondering if the remote host has a security layer I don't know about.
Might well be the Windows XP SP2 firewall or another like Symantec, Panda,
whatever? Turn it off and check it again.
Either that or there is no listener on port 7000 on the remote machine?
What's meant to be listening?
Loading...