Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Posted
I don't know if this helps, but i recently use the TcpClient class with an ip and port like this:
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);

Posted

I'm 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: I'm still new at this so I'm just telling you what works for me. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...