Packet driver TCP/IP stack

DOS specific questions.
etko
Posts: 113
Joined: May 27, 2005 7:55
Location: Slovakia
Contact:

Packet driver TCP/IP stack

Post by etko »

Hi is there any way to use TCP/IP in DOS FreeBASIC? I've heard that there is some TCP/IP stack supporting packet driver for DJGP or what the name of DOS GCC is.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

Late EDIT : kicked, see below for newer and better post
Last edited by DOS386 on Feb 17, 2009 11:34, edited 1 time in total.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

Yeah, I think the WATTCP library is available for DJGPP and would then work with FreeBASIC - I haven't looked into it in depth yet, but I will certainly do so sometime in the future.

There's a bunch of open-source/free packet drivers available here that should work with WATTCP: http://crynwr.com/
Last edited by DrV on Mar 12, 2006 1:39, edited 1 time in total.
hippy
Posts: 84
Joined: Nov 04, 2005 18:13
Location: UK

Post by hippy »

DOS programs can hook into Crynwr packet drivers fairly easily which allows raw packets to be pulled from and put to ethernet. I've done it with DOS PowerBasic / FirstBasic and a small bit of MASM because I couldn't get the call-back on packet arrival to work properly, so I guess FB can do the same, and probably easier.
etko
Posts: 113
Joined: May 27, 2005 7:55
Location: Slovakia
Contact:

Post by etko »

I would like to get full TCP/IP stack, when I'll get some more time i will try to look at that WATTCP.
Mike Chambers
Posts: 85
Joined: Jun 18, 2006 19:48

Post by Mike Chambers »

i actually just recently developed a full set of routines for TCP/IP in DOS. my code interfaces with wattcp. it was made in and designed for quickbasic 4.5, but it should work fine in freebasic. it requires the CALL INTERRUPT function to work, but i have been told there's a freebasic library that allows that but i have not tried it myself.

download my routines here:
http://rubbermallet.org/qb
Fox
Posts: 353
Joined: Aug 08, 2006 13:39
Location: Lille, France
Contact:

Post by Fox »

Hi there!

I see that the last update is dating 2006... Does anybody has a positive experience using network under FreeBASIC (DOS)?
I asked about Watt32 in another thread, but maybe there's any other way to do network stuff in DOS today (what about Mike's library? Any chance to make it working in FreeBASIC?)
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

Hi is there any way to use TCP/IP in DOS FreeBASIC? I've heard that there is some TCP/IP stack supporting packet driver for
Fox wrote:Does anybody has a positive experience using network under Fr
As a user, YES. Arachne and DOSLYNX browsers and WGET downloader (with some hacks) do work. No external stuff is required except a packet driver. So YES, there is TCP/IP in DOS ... and FreeBASIC should not be a problem considering that it can use DGJPP libs and DOSLYNX and WGET use DGJPP as well.

However, I have no idea how it's done :-( Also, what are you tying to do ? I have no idea what a "simple" example could do ...
There's a bunch of open-source/free packet drivers available here that should work with WATTCP: http://crynwr.com/
Indeed some specs and drivers ... 20 years old :-D
Fox
Posts: 353
Joined: Aug 08, 2006 13:39
Location: Lille, France
Contact:

Post by Fox »

DOS386 wrote:As a user, YES. Arachne and DOSLYNX browsers and WGET downloader (with some hacks) do work.
Yes, of course - I do know that there are networking possibilities under DOS. I am using myself DOSLynx from time to time, as well as I am copying stuff to my DOS computer using SCP2DOS. ;-)
However, I have no idea how it's done :-( Also, what are you tying to do ? I have no idea what a "simple" example could do ...
Ahh, too bad then :-(
In fact, I was wondering about writing a DOS gopher client in FreeBASIC, but so far I didn't succeeded to let FreeBASIC send anything via the network, so I guess my project won't happen ever...

Digging with some QuickBasic code, I was able to establish some TCP connections to a server, but I got no results using FreeBASIC.
Fox
Posts: 353
Joined: Aug 08, 2006 13:39
Location: Lille, France
Contact:

Post by Fox »

Hey there :-)

I'm still looking after any way to use network with FBC/DOS...

I found recently a program called "TCPPORT.EXE" (shipped with Watt32). It seems that this program may be used as a mean way to do network inside a third-party program. From what I understood, TCPPORT.EXE is emulating a serial port, to which my program would have to bind somehow...

An example call would be:
tcpport 192.168.0.10 80 myprogram.exe

There's some talk about using "software interrupt 14 instead of hardware serial port". I have no idea what it could mean :-)

As far as I know, FreeBASIC may open hardware serial ports using OPEN COM, but is there any way of opening a "software int 14" serial port instead?

Sorry for that lame post, I know that I have very little idea of what I am talking about :-/
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Post by MichaelW »

The system BIOS provides a Serial Communications Service through Interrupt 14h, and I’m guessing that TCPPORT is hooking this interrupt so it can intercept the calls from your program. For this to work your program would need to use the BIOS service to interface with TCPPORT as it would interface with a serial port. For FBDOS, the “COM” interface may ultimately call the BIOS service, or not, I can only guess. The DOS functions should use the BIOS service, or you can do it through Interrupt 14h. For this you can probably get most of the information you need from Ralf Brown’s Interrupt list.

An HTML version is here:

http://www.ctyme.com/rbrown.htm

And the download version here:

http://www-2.cs.cmu.edu/~ralf/files.html

And BTW, you should expect the data transfer rate to be relatively slow, because the BIOS service transfers only one character per interrupt.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

MichaelW wrote:The system BIOS provides a Serial Communications Service through Interrupt 14h, and I’m guessing that TCPPORT is hooking this interrupt so it can intercept the calls from your program. For this to work your program would need to use the BIOS service to interface with TCPPORT as it would interface with a serial port. For FBDOS, the “COM” interface may ultimately call the BIOS service, or not
FB seems NOT to use INT $14 (see libfb-v0.20.0b-src.zip\src\rtlib\dos\libfb_io_serial.c), for the reason discussed in the past - only 1 byte per call, unusably slow. So OPEN COM will NOT see your hack and continue "talking" to the real serial port :-(
Fox
Posts: 353
Joined: Aug 08, 2006 13:39
Location: Lille, France
Contact:

Post by Fox »

DOS386 wrote:FB seems NOT to use INT $14 (see libfb-v0.20.0b-src.zip\src\rtlib\dos\libfb_io_serial.c), for the reason discussed in the past - only 1 byte per call, unusably slow. So OPEN COM will NOT see your hack and continue "talking" to the real serial port :-(
Ahh, too bad...

I lost my hope again :-(
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Post by Dinosaur »

Hi all

Fox, can you give us more detail on what you are trying to do with a Network from within your Dos program ?

We both appear to have the same problem, although going about it differently.

Regards
Fox
Posts: 353
Joined: Aug 08, 2006 13:39
Location: Lille, France
Contact:

Post by Fox »

Dinosaur wrote:Fox, can you give us more detail on what you are trying to do with a Network from within your Dos program ?
Hi!

Well... To tell you the full truth, I would love to write a Gopher client for DOS. Unfortunately, I'm stuck with the network layer :(
What I would like to achieve, is one of the following things:
- Using some network calls in my program (something like "OpenStreamSocket(192.168.0.10, port 70)")
or
- Use an external program to do network stuff (something like OPEN PIPE "telnet 192.168.0.10 70" FOR RANDOM AS #1)
or
- Use any other magic to get a stream access to network things (like OPEN "COM9" FOR RANDOM AS #4, where COM9 would be a hacked socket)

Besides that, I need a way to do some DNS resolvings, too. Or _at least_ a way to initiate UDP "streams" (then I would write the DNS support by myself).

So far, I had no success at all using any kind of network things on FB/DOS... But I still keep hoping that someone will sort it out and post some clues there :-)

Dinosaur, what has been your experience in that matter?
Post Reply