chris_dev
2007-03-29 17:50:01 UTC
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.
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.