Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i want to use fixed client port no. with that client m/c ip.how can i assign port no. to (clientsocket.ipaddress.port).so that everytime diff. port no should not used.i want to fix it.plz mail me at:-rajni@myvacations.co.uk
Posted
Updated 3-Jan-10 22:12pm
v2

1 solution

m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

// Cet the remote IP address
IPAddress ip = IPAddress.Parse(txtIPAddress.Text.ToString());
int iPortNo = System.Convert.ToInt16("8000");
// Create the end point
IPEndPoint ipEnd = new IPEndPoint(ip, iPortNo);
// Connect to the remote host
m_clientSocket.Connect(ipEnd);
 
Share this answer
 

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