View Full Version : Making my own networking protocol
EvBladeRunnervE
08-20-2003, 12:25 PM
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?
lithium
08-20-2003, 08:40 PM
first of all you probably want to incorporate your protocol into TCP/IP
for example:
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.
EvBladeRunnervE
08-20-2003, 09:00 PM
how about linux then? could I program my own totally from scratch protocol?
Prelude
08-21-2003, 07:51 AM
>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?
EvBladeRunnervE
08-21-2003, 08:19 AM
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.
Prelude
08-21-2003, 08:48 AM
>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.
EvBladeRunnervE
08-21-2003, 12:47 PM
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.
Hammer
08-21-2003, 07:26 PM
OSI Model links:
http://webopedia.internet.com/quick_ref/OSI_Layers.asp
https://secure.linuxports.com/howto/intro_to_networking/c4412.htm
http://searchnetworking.techtarget.com/sDefinition/0,,sid7_gci523729,00.html
lithium
08-21-2003, 09:30 PM
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.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.