.NET Samples - How To: Networking
This section includes the following samples:
DateTimeServer Sample
DateTimeClient Sample
ClientGETasync Sample
WebRequestAsync Sample
Chat Sample
ClientGETwithProxy Sample
ClientGETwithNTLM Sample
ClientGETwithSSL Sample
ClientGET Sample
ClientException Sample
WebRequest Sample
ClientPOST Sample
DateTimeServer Sample
This sample illustrates how to use the TCPListener class to create a DateTime server program.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
(none)
DateTimeClient Sample
This sample illustrates using the TCPClient class to create a DateTime program.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Net; System.Text; System.IO; System.Net.Sockets
Classes used in this sample:
Console; String; TcpClient; Stream; Dns; Socket; Encoding; InvalidOperationException; Exception; Operation
ClientGETasync Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI asynchronously.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Net; System.Threading; System.Text; System.IO
Classes used in this sample:
Stream; Buffer; String; Console; WebRequest; AsyncResult; HttpWebRequest; ManualResetEvent; Decoder; WebResponse; AsyncCallback; HttpWebResponse; Uri; StringBuilder; Site; Thread; Convert; Encoding
WebRequestAsync Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI asynchronously.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Net; System.Threading; System.Text; System.IO
Classes used in this sample:
WebRequest; HttpWebRequest; Buffer; Import; String; AsyncResult; Stream; StringWriter; Site; Thread; HttpWebResponse; WebResponse; TextBox; Uri; StreamReader; Encoding; EventArgs; Button; AsyncCallback; Page; Object
Chat Sample
This sample illustrates using the UDPClient class to create a chat client.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Net; System.Threading; System.Text; System.Net.Sockets
Classes used in this sample:
Console; Port; Group; String; Thread; Encoding; EndPoint; IPEndPoint; IPAddress; Dns; UdpClient; Array; IPHostEntry; ThreadStart; Exception; Socket
ClientGETwithProxy Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI through a proxy.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Console; Stream; Encoding; Object; Page; StreamReader; WebRequest; String; WebProxy; GlobalProxySelection; Exception; WebResponse
ClientGETwithNTLM Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI with NTLM authentication.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Console; Stream; String; Encoding; StreamReader; WebRequest; Page; NetworkCredential; Exception; WebResponse
ClientGETwithSSL Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI with Secure Sockets Layer (SSL).
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Console; Stream; String; Encoding; WebRequest; Page; StreamReader; Exception; WebResponse
ClientGET Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Console; Stream; String; Encoding; WebRequest; Page; StreamReader; Exception; WebResponse
ClientException Sample
This sample illustrates how to use the WebException and URIFormatException classes to deal with exceptions when accessing URIs.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Console; Uri; Exception; Stream; String; WebException; Encoding; StreamReader; FormatException; WebRequest; Form; UriFormatException; WebResponse; Convert; NetworkCredential
WebRequest Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a GET request on a URI.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.IO
Classes used in this sample:
Encoding; Stream; TextBox; WebRequest; Import; Object; WebResponse; Button; Page; String; Exception; EventArgs
ClientPOST Sample
This sample illustrates how to use the WebRequest and WebResponse classes to make a POST request on a URI.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Text; System.Net; System.Web; System.IO
Classes used in this sample:
Console; Stream; String; Url; Encoding; Page; StreamReader; HttpUtility; WebRequest; StringBuilder; Exception; WebResponse; Type