Thread: Making my own networking protocol

  1. #1
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790

    Making my own networking protocol

    How would I go around doing this, i mean, using winsock as the base means to an end. I know about having to make my own encapsulation algorithms, but how could I make winsock use it instead of say, "TCP/IP" or UDP?

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    88
    first of all you probably want to incorporate your protocol into TCP/IP

    for example:
    Code:
    typedef struct{
     char name[50];
     int fd;
     int id
     char message[3000];
    }protocol;
    as an example. just sent the header over winsock in a normal send() call.

    if what you want is really to avoid TCP and UDP you want to learn raw sockets. however windows (except 2000 and xp) do not support raw sockets.

  3. #3
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    how about linux then? could I program my own totally from scratch protocol?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >could I program my own totally from scratch protocol?
    You could...but it would be virtually useless. For all of the work that goes into something like this, only the people using your protocol would be able to communicate with your programs unless you make them compatible with TCP/IP. If that is the case, why even bother with your own protocol in the first place?
    My best code is written with the delete key.

  5. #5
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    You could...but it would be virtually useless. For all of the work that goes into something like this, only the people using your protocol would be able to communicate with your programs unless you make them compatible with TCP/IP. If that is the case, why even bother with your own protocol in the first place?
    making a semi secure network connection, after all, if only 2-3 people and computers have the protocol, i wouldnt have to worry about people reading it. Plus, it would provide a valuable learning experience.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >making a semi secure network connection
    A decent encryption gives you the same effect.

    >Plus, it would provide a valuable learning experience.
    This is a better reason. My recommendation would be to study some simpler protocols out there and see how they do it, then try your hand at imitating them. Who knows, you may even be able to find a tutorial on google.
    My best code is written with the delete key.

  7. #7
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    ok, thanks. I am at this point trying to learn how to do the lower level of stuff, as that will make be be able to see the whole picture of higher level stuff from the ground up. Plus, in the tutorials in the links, they never actually say how send and recv work. does send just write data to the port that you have set up on?

    EDIT: hmm, did a search for network protocol making tutorials in several different phrases and got alot of microsoft sites just talking about winsock, and got sites talking about network protocol sniffers, but no tutorials or sample protocol code.
    Last edited by EvBladeRunnervE; 08-21-2003 at 03:03 PM.

  8. #8
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  9. #9
    Registered User
    Join Date
    Jan 2003
    Posts
    88
    Originally posted by EvBladeRunnervE
    how about linux then? could I program my own totally from scratch protocol?
    yea, i program raw sockets on linux.

    and to learn how the functions work download glibc. that has all the functions that are called standard from C in linux. you dont have to install it even if you dont feel like upgrading your glibc, just search around for functions in the folders.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. networking comfirmation
    By rEtard in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-20-2005, 03:59 PM
  3. Networking Protocol
    By Hunter2 in forum Networking/Device Communication
    Replies: 14
    Last Post: 12-11-2003, 04:51 PM
  4. Beyond MFC : COM || Networking
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2002, 04:28 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM