Jump to content
xisto Community
bobbybeeelan

How To Make A Protocol

Recommended Posts

Start with a piece of paper and start writing down everything you want in this protocol, maybe you can even put it in a diagram or something like that. Try to be clear tough because you'll need this information.With this information you'll have to design the messages you want to send between server and client (and vice versa). These messages can be bytestreams, SOAP messages, ... But make sure they are a bit versatile (it's most efficient if all message headers have the same length). Next thing on the list is writing a server and a client, the server listening on a port and the client sending your protocol messages to the server.That the scenario in short :o

Share this post


Link to post
Share on other sites

Iâm getting the feeling that you are not very serious in your question but I will still do my best to answer it. The protocol will depend on what you are using it for. A typical application protocol will use many of the existing protocols such as TCP and IP. A fairly complex example of a protocol is the Yahoo! Messenger protocol or YMSG which I have a tutorial for at http://forums.xisto.com/no_longer_exists/ (shameless plug).

As I said before, it all depends on the application. Letâs say I need to communicate weather conditions between two points, over the Internet, and using standard PCs. I would first designate one of the computers as a server and the other as a client. Since we are using the Internet, I will use standard TCP/IP. On the server I will create a listening port (in .NET you can use TCPListener - http://forums.xisto.com/no_longer_exists/) and on the client I will initiate a connection (TCPClient - http://forums.xisto.com/no_longer_exists/). Once you issue each command, the operating system takes care of all the tedious work of getting the connection working. Now you have a connection where you can send anything you want until either end closes the connection.

In the weather example you may want to send temperature, humidity, and wind speed to the server. Additionally you may also want to identify the client by a unique identifier. All of these things are fairly straight forward so I would just create a string and separate each entry by a colon.

ClientID:Temp:Humidity:WindSpeed

The client then issues a send command on the string. The server then receives the string and splits it based on the colons. This is a very simple example but still a network protocol. As long as each field is defined and sent in a particular order, any server will be able to use the weather data that you sent.

I suggest you start with the networking objects in the language you are using and then work out from there.

Share this post


Link to post
Share on other sites

I would add two fields to this protocol : "from" and "to".It would probably be useful to know which weather station sends the info, and which server is gathering the infos, so two extra fields are needed.

Share this post


Link to post
Share on other sites

This is a great example of tailoring your protocol to meet your needs. I was assuming that there is only one server so the “to” field is not needed. The ClientID should take care of your “from”. Of course this all doesn’t matter because it is a fictional system but it shows that you only need one thing for a protocol; knowledge on both ends of what is in the message and how it is ordered.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.