 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Socket Programming in C#
The System.Net.Sockets namespace has a managed implementation of the Windows Sockets interface.
It has two basic modes − synchronous and asynchronous.
Let us see an example to work with System.Net.Sockets.TcpListener class −
TcpListener l = new TcpListener(1234); l.Start(); // creating a socket Socket s = l.AcceptSocket(); Stream network = new NetworkStream(s);
The following is the Socket useful in communicating on TCP/IP network −
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Above,
- AddressFamily − It is the standard address families by the Socket class to resolve network addresses 
- SocketType − The type of socket 
- ProtocolType − This is the network protocol for communication on the Socket. It can be Tcp and Udp. 
Advertisements
 