Click here to Skip to main content
15,889,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi everyone i need help in
how i can send string from Client on WAN to Client In LAN by .net
thanks for amy help
Posted
Updated 12-Sep-11 20:24pm
v2
Comments
Prerak Patel 13-Sep-11 2:46am    
More details please!

1 solution

You need to create a tunnel to bridge your LAN firewall and open ports on the WAN interface.

Most routers have a "virtual server" configuration for this which will map a port to an internal LAN server and port number.

Sending and receiving you can do with the TcpClient class.
 
Share this answer
 
Comments
Mostafa Elsadany 13-Sep-11 20:13pm    
how in tcpclinet
TcpClient tcpclnt = new TcpClient("192.168.1.199", 8001);

NetworkStream mynetsream = tcpclnt.GetStream();
StreamWriter myswrite = new StreamWriter(mynetsream);
myswrite.WriteLine(TextBox1 .Text );
myswrite.Close();
mynetsream.Close();
tcpclnt.Close();
//System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
//byte[] bt=encoding.GetBytes(TextBox1.Text.ToString ());
//EndPoint ourEP = new IPEndPoint(IPAddress.Any, 8001);
//tcpclnt.Client.SendTo(bt, ourEP);
tcpclnt.Close();
Response.Write(tcpclnt.Connected.ToString());
i can't add IP to internet
Mehdi Gholam 13-Sep-11 22:16pm    
Change 192.168.1.199 to an Internet ip
Mostafa Elsadany 14-Sep-11 2:29am    
any code plz
Mehdi Gholam 14-Sep-11 2:33am    
Just change your IP address in the TcpClient(...)
Mostafa Elsadany 17-Sep-11 7:42am    
i change to ip from whatismy.com but still problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900