[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

JimSchacht

10/21/2003 5:57:00 PM

OKI, i'm pretty new to the whole network programming thing but i'm very
familiar with the framework. that being said, how do i go about creating a
TCP with a computer on a different network. i can create tcp connections on
machines within my olocal network with no problems either by DNS name or ip
address but as soon as i try to connect to a remote machine my program
cannot find them. this needs to be a tcp connection as apposed to http.


1 Answer

Ron Alberda [MSFT]

10/21/2003 10:12:00 PM

0

If you can ping the machine you should be able to connect to it using the
..Net Framework. Just do a Dns.Resolve.

C# sample that connects to the HTTP port of a server:

IPHostEntry serverHE = Dns.Resolve("servername");
IPEndPoint serverIP = new IPEndPoint(serverHE.AddressList[0], 80);

Socket client = new Socket(serverIP.AddressFamily, SocketType.Stream,
ProtocolType.Tcp);
client.Connect(serverIP);

-Ron

"JimSchacht" <jimischacht@comcast.net> wrote in message
news:uxv9rx$lDHA.2068@TK2MSFTNGP09.phx.gbl...
> OKI, i'm pretty new to the whole network programming thing but i'm very
> familiar with the framework. that being said, how do i go about creating a
> TCP with a computer on a different network. i can create tcp connections
on
> machines within my olocal network with no problems either by DNS name or
ip
> address but as soon as i try to connect to a remote machine my program
> cannot find them. this needs to be a tcp connection as apposed to http.
>
>