Download presentation
Presentation is loading. Please wait.
Published byStephen Moody Modified over 9 years ago
2
Socket class ◦ provides a rich set of methods and properties for network communications. The Socket class allows you to perform both synchronous and asynchronous data transfer using any of the communication protocols listed in the ProtocolType enumeration. AddressFamily ◦ Specifies the addressing scheme that an instance of the Socket class can use. (i.e. InterNetwork for IPv4 address, InterNetworkV6 for IPv6 address, etc.)
3
SocketType Enumeration ◦ Specifies the type of socket an instance of the Socket class represents. ◦ SocketType will sometimes implicitly indicate which ProtocolType will be used within an AddressFamily. ◦ For example, when theSocketType is Dgram, the ProtocolType is always UDP. When the SocketType is Stream, the ProtocolType is always TCP. If you try to create a Socket with an incompatible combination, Socket will throw a SocketException. ProtocolType Enumeration ◦ Specifies the protocols that the Socket class supports. For example, IP, TCP, IPv6, etc.
4
IPEndPoint Class ◦ Represents a network endpoint as an IP address and a port number.
5
Echo server and echo client are the socket programming equivalence of Hello World program found in typical programming example. The main objective of echo server is to reply back (echo) the same message sent by client. Download and Run the program
6
Modify the echo server program that will reply back the same sent by client but in uppercase.
7
Big-endian to Little-endian Big-endian – Most significant byte first Little-endian – Least significant byte first To convert an IP address to integer, break it into four octets. For example:
8
Big-endian ◦ IP uses big-endian in network, also known as network order Little-endian ◦ Host system running on windows operating system uses little-endian Therefore, we need to convert from big- endian to little-endian
9
IPEndPoint Class ◦ Represents a network endpoint as an IP address and a port number. IPAddress.HostToNetworkOrder Method ◦ Converts a value from host byte order to network byte order. Pnt.Address ◦ Gets or sets the IP address of the endpoint.
10
Write a program that will convert from little- endian to big-endian.
11
Example: HostIP.cs Dns.GetHostName() Method ◦ Gets the host name of the local computer Dns.GetHostEntry(String) ◦ Resolves a host name or IP address to an IPHostEntry instance.
12
A machine could have several IP addresses. Write a program that will display your own IP address.
13
Get IP addresses from Domain Name.
14
WelcomeServer.cs WelcomeClient.cs
15
Modify the WelcomeClient.cs program that client will look for (search) the server IP address and get connected.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.