Sunday, February 11, 2007

Socket level programming




Write two programs, one for the Client and one for the Server. Select a port on the Server Computer on which the two programs will communicate with each other i.e a port where the Server program will listen for the messages from the Client and the Client will use this port for sending messages to the Server.
Use this port number in your Client and Server programs.
Run both the programs simultaneously and check whether both are communicating with each other at that socket by sending a message from the Client to the Server.
Once the client and the server communication is established, you can choose to send data from the client to the server in any form including xml files. If the data is sent in xml, then the server program receives this file and extracts the data using the xml parser .
This type of socket programming can be useful in areas where the server needs particular kind of data from the client to store that information in its database.
Another interesting way of communication at the socket level is via the network packets which can be created using a pre-decided standard set of rules. Each packet will contain information in a certain standard format and will be sent by the client over the network to the server, which accepts and decodes it. An example where this kind of programming can be used is in the CAS application system where a user selects to subscribe to certain TV channels and this information is encoded in BITS and sent by the Client in the form of a network packet to the Server, which decodes it and stores this information about a given user in the database.

I had written this program some 4 years back.

No comments: