Reputation: 337
I need to create an instance of Socket class , But i am not sure what parameters should I parse to create TCP socket ,
System.Net .Sockets .Socket s = new System.Net.Sockets.Socket
(//what are the parameters required in here ?")
Upvotes: 0
Views: 84
Reputation: 3923
For tcp :
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
For Udp :
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
The above code example shows you have to instantiate a socket in either way
Upvotes: 2