Overview
One of the important programming studied within the scope of this is client server socket programming. By studying the socket programming techniques, it can be seen how the way a computer can send messages with text, video images, music, or other over the internet.
What is a Socket?
Definition of the socket as follows (Shuttleworth, 2003, p.5):
- Permit a unique process to communicate one with others
- Inform the process where to write or read
- Communication on the same machine, network and The Internet
- Communication two direction make match for the client server model
- Be formed 1980 by Berkeley Unix Distribution
If all goes well, the server accepts connections (virtual circuits). When receiving, the server opens a new socket which is connected to a different port. To be continued acceptance of the initial socket for connection requests while serving the needs of the connected client, needed a new socket (with a different port number).
On the client side, if the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server. Client and server can now communicate to write or read from the socket.
There are 2 kinds of protocols can be used on the socket, namely:
- TCP connection-oriented and reliable
- Connection-oriented, to do communication be required connection especially ago
- Reliable, guarantee arriving data packets to computer destination and do checking. If there is data packets are lost or damaged the TCP socket will ask corrupted data packets or disappear mentioned to all received data packet in good condition.
- UDP is connectionless and unreliable.
- Some commonly used port number 21 (FTP), 23 (telnet), 25 (SMTP), 69 (TFTP), 80 (HTTP), 161 (SNMP).
Type Socket
When a socket is formed, the program must specify the domain address and the socket type. Two processes can communicate with each other only if the type and the same domain. There are two commonly used address domains, namely:
- Unix domain socket that is not can reach from the Internet directly, but with with advent demand on the server.
- Internet domain is two processes running on two host fruit in communication the Internet. socket address of The Internet domain consists the Internet address of host machine. Apart it, each socket requires port number on the host. No. ports such as 16-bit unsigned integers. figure is low provided in Unix to service standards. As example, the port number for the FTP server is 21. It is important that service standard will be on the same port on all computer so that the client will know address. Well-known port numbers is no available port 65536.
For there are two kinds of socket types, Stream and Datagram socket socket (www.redbrick.dcu.ie/).
- Stream socket is communication continuous stream of character (using TCP protocol)
- Datagram socket is reading whole message with immediately (using UDP protocol)
Windows Sockets (WinSock)
Windows operating system has an Application Programming lnterface (API) to communicate over TCP / IP is known as WinSock API. Programming API itself is very difficult because the programming API has been dealing with low level. Low levels are not allowed to be accessed directly. However, Windows has provided API, which is a set of functions to access the lower level. To assist programmers in terms of making software that can communicate with other computers then provide an ActiveX control component named Winsock Control.
Winsock specifically defined by how a Windows network software should access network services, especially TCP / IP (definition-info.com). Winsock provides a single API where developers of software applications and networks need to adapt. For some versions of Windows, winsock is defined as a binary interface that ensures a match on the Winsock API applications that can run on the network from different software developers. Winsock based on BSD (Berkeley) sockets, but provide additional functionality that allows programming API works on standard window.
With Winsock control the programmers do not need to know the details of TCP / IP and API function calls to set up a network for application programmers to use only methods, properties or events held by Winsock. Process of client-server communication using sockets can be seen in the image below:
0 comments:
Post a Comment