In visual studio 2003 can you no longer just use the port number as an argument?Do you have to specify an IP address, is there no way around using an IP address?
I dont know if this helps, but i recently use the TcpClient class with an ip and port like this:
Code:
TcpClient myclient = new TcpClient("1.2.3.4",5000);
NetworkStream ns = new NetworkStream(myclient);
StreamReader sr = new StreamReader(ns);
StreamWriter sw = new StreamWriter(sw);
sw.WriteLine("Hello Server");
sw.Flush();
string s = sr.ReadLine();
Console.WriteLine(s);
Im sorry, that was for the client side, .. on my server side i just use the Port number. I think you are supposed to use an IPAddress Object, but it will still work with just the port.
TcpListener listener = new Tcplistener(5000);
disclaimer: Im still new at this so Im just telling you what works for me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.