I'm developing an application in ASP.NET using Visual Basic, that have to connect to a Server in my private network. The application must working only into my network (in future it can work on internet, too), now I have a problem with TcpClient on ASP.NET: If I connect to the Server using an instance of IPAddress
Client = New TcpClient
Client.Connect(New IPAddress("192.168.1.12"), 6001)
the Socket try to connect to 176.64.116.11 (that's not my public IP Address...), else, if I connect to the server with a string that contains the local IP Address
Client = New TcpClient
Client.Connect("192.168.1.12", 6001)
the Socket connects succesfully but nothing responds to my command (with NetworkStream.Write
and Read
) I try all of these in a Windows Application and all work succesfully.
Thanks to all (I made any mistake in English? Ahaha, sorry :D)
PS. If you post me some code in C# don't worry, I can translate it
TcpClient
has various overloads, you can give it a string
containing the ip address or an IPAddress
object.
Also, use
IPAddress ipAddress = IPAddress.Parse("192.168.1.12");
IPAddress
does not contain a constructor that takes a string
.
http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.connect.aspx
As for your transmission issue; disable firewalls. Try localhost first.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.