TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Brett Maxfield
from: Jonathan de Boyne Pollard
date: 1996-07-28 22:16:36
subject: sockets with emx/gcc & w

BM>
  >     1. use socket() to open a endpoint for the connection
  >
  >     2. get the local hostname using gethostname()
  >     3. get the ip address for the local host using gethostbyname()
  >     4. bind() this address to the socket got by socket()
  >
  >     5. use listen() to enable incoming connects
  >     6. accept() an incoming connection, or wait for one
  >     7. spawn or fork a process to handle that connection
  >
  >     8. go back to 6, or close if there was an exit request.
BM>

  Far better to start a thread, rather than create a whole new process for
  the job.  This is especially so if the server code for an individual
  socket shares resources with the server in general such as open file
  handles.

BM>
  > Basically i want to write daemon that will get tcp/ip
  > port and spawn processes to perform io on each incoming
  > connection (the same as telnetd would)..
BM>

  On the other hand, do not re-invent the wheel.

  Write a daemon that can be invoked from inetd, update the information in
  the inetd configuration file, and let inetd do all of the hard work of
  accepting the connections for you.

  > JdeBP <
___
 X MegaMail 2.10 #0:

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 440/4 141/209 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.