Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-08

sockets under win32

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Benno J. Mengis

Hi everybody

are the socksvr/sockcli examples from fcl only for linux or also for win32. i can not make them, got the impression, ssockets is only for linux. is there other example code avaiable on how to use sockets (or winsock) on a win32 system? any help would be appreciated.
MeBSo

Fernando Lozano
to Benno J. Mengis

Benno,

are the socksvr/sockcli examples from fcl only for linux or also for win32. i can not make them, got the impression, ssockets is only for linux. is there other example code avaiable on how to use sockets (or winsock) on a win32 system? any help would be appreciated.

I have compiled a linux sample program (built my myself as part of a computer science course, I am teacher) on Windows 98 and it behaves very funny: If I run under gdbpasw it works as expected, but if I run the program on the DOS prompt it displays garbage... Is this a bug on the Windows socket unit (fpc 1.0.4) or is it something about using a DOS box?

[]s, Fernando Lozano

Thomas Schatzl
to Benno J. Mengis: Hi everybody are the socksvr/sockcli examples from fcl only for linux or also for win32.…

From: "Benno J. Mengis"
Subject: [fpc-pascal]sockets under win32

Hi everybody

are the socksvr/sockcli examples from fcl only for linux or also for

win32.

i can not make them, got the impression, ssockets is only for linux.

Linux only. To do windows socket programing it's best to use the winsock unit (e.g. from the contribs' page or the Delphi - JEDI header conversions).

is there other example code avaiable on how to use sockets (or winsock) on a win32 system? any help would be appreciated.

I recommend to try "Beej's Guide to Socket programming" from http://www.ecst.csuchico.edu/~beej/guide/net/ which is a imo good introduction to basic sockets programming (e.g. sending and receiving data, how to do a basic server).
The example code inside is written in C there should be no problem porting it, it's pretty straightforward and the examples are quite small too (nearly the same as the ones in the RTL docs). Additionally he focuses on the Linux platform - but he does _not_ use any Linux specific capabilities at all (e.g. using socket handles as file handles as it is done in the RTL docs). A small section about the changes for the Win32 platform is included (some additional startup code).

If you do have problems to convert those programs feel free to ask.

Regards,
Thomas