www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/04/16:17:48

From: Richard Dawe <rich AT tudor21 DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: networking and DJGPP...
Date: Fri, 04 Feb 2000 19:57:53 +0000
Organization: Customer of Planet Online
Lines: 64
Message-ID: <389B2F41.724B7871@tudor21.net>
References: <389A1368 DOT 553E6741 AT geocities DOT com>
NNTP-Posting-Host: modem-120.phosphorus.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg3.svr.pol.co.uk 949694359 7230 62.136.14.120 (4 Feb 2000 19:59:19 GMT)
NNTP-Posting-Date: 4 Feb 2000 19:59:19 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

> For network (TCP/IP or IPX) I know that I have to a library called
> TCP-Lib (or something to that effect)

Take a look at libsocket:

http://libsocket.tsx.org/

or Watt-32:

http://www.bgnett.no/~giva/

libsocket works with Windows. Watt-32 works with DOS. I'm currently trying
to merge Watt-32's code into libsocket, so that libsocket will run on DOS
& Windows.

> and for Modem there is something called Serial-something.

bcserio? dz-something or other? I can't remember off the top of my head.
Take a look in v2tk/ of the DJGPP archive. I know nothing about serial
communications.

> Lets say I want to write a small program that passes 3 items
> to the other computer: angle, velocity, and the userid...  how would I
> write this???

You need some kind of communications protocol. You could just send
structures like:

struct data_item {
	float angle;
	float velocity;
	uid_t user;
};

If this is running on multiple platforms (i.e. more than just DOS,
Windows), then you might have to think about how the data is sent - big
endian, little endian, etc.

With the networking you have a choice of protocol - TCP over IP or UDP
over IP. If you use TCP/IP, then it's possible that the whole of the above
structure would not be sent in one packet. You may like to use UDP/IP
instead. I recommend reading some books on TCP/IP networking programming,
like W. Richard Stevens book on Unix Network Programming (very good book).

We had a discussion on the libsocket mailing list a while back about using
networking in a game. It may be worth looking at the libsocket mailing
list archives - look at the mailing list page here:

http://libsocket.tsx.org/

> If there is a web-site about this, plz direct me to it...

For BSD sockets networking, which both libsocket and Watt-32 support, take
a look at Beej's guide:

http://www.phekda.freeserve.co.uk/richdawe/lsck/beej/

HTH, bye,

-- 
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019