Apr
10

Creating a Simple Chat Program 2 Direction UDP With C #

Label:

Continuing from my previous post about making the program simple chat with TCP , this time I'll share a little about making the program simple chat with the UDP protocol, because if only the TCP incomplete without UDP, happened yesterday is a friend who asked ... heheheh ..
Previously we warm up for a moment to find a glimpse of the UDP protocol. Similar to TCP, UDP is the rule in communication between networks but methods and different properties. These protocols are unreliable, unlike TCP, why? Because the messages are sent as UDP datagrams without a serial number or Ack messages. This protocol is also conectionless, why? Because UDP messages will be sent without having made ​​the connection negotiation process between the two hosts who want berukar information. Then if so to what this protocol is ... .. Usually, UDP is used for network communication that emphasizes speed, and not think about the ability of whether this message until directed safely or not that important messages delivered quickly, and thinking about memory consumption and minimal resources. Examples of technology that uses the RIP (Routing information protocol) on Cisco routers, in addition to the NFS (Network File System) and TFTP (Trivial File Transfer Protocol) also uses UDP you know ... ..
Straight to cut the program just a little explanation.
 

IPEndPoint ipep = new IPEndPoint (IPAddress.Parse ("127.0.0.1"), 9050); 
Socket server = new Socket (AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp); server.Connect (ipep); 
 
Similar to TCP, which determines the main we use here only Dgram Socket, socket used in the UDP protocol.
For the source code fullnya version i;m share in here.





0 komentar:

Posting Komentar