Sign in Join

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

Mailing lists / fpc-pascal / 2002-08

linux Socket programming question with inetd as launcher

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Stefan Becker

Hi everybody,

I am trying to write a socket (client/server) communications. I've decided to write the server simply by using the inetd.conf as a launcher and reading and writing to STDIN/OUT.

500 stream tcp nowait root /usr/sbin/tcpd /home/becker/pascal/MyServer

This really works!

If I telnet to the socket I can connect and communicate to my application!

like: > telnet localhost 500

Now : If I write my OWN programm with the socket unit and open a channel to the service running on say port 500 what port do I listen to and open to receive the answering connection? Or how do I tell the inetd service im connecting
to where I am listening?

this really has me stummped.......

I hope some one will be able to help me out!

thanks,

Stefan

email:

Reply by email

Georgi Georgiev
to Stefan Becker

--- Stefan Becker wrote:
...

If I telnet to the socket I can connect and communicate to my application! like: > telnet localhost 500

...

this really has me stummped.......

The attached program must connect to localhost
at port 500 (i notice you that port and IP address are represented into TInetSocketAddr record in
reversed byte order).

I don't know if the inetd waits for some terminal
recognition secuences and if my cli_500.pp will
send/receive bytes properly !

=====
Skelet
====== http://skelet.hit.bg

__________________________________________________ Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Reply by email

Georgi Georgiev
to Stefan Becker: I am trying to write a socket (client/server) communications. I've decided to write the…

--- Stefan Becker wrote:

Sorry, y forgot to attach the program !

This program is designed to work in
assyncronous mode. You may simplify it if
you don't need so riple socket handling !

=====
Skelet
====== http://skelet.hit.bg

__________________________________________________ Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Reply by email

Fernando Lozano

Stefan,

Show quoted text 9 lines
I am trying to write a socket (client/server) communications. I've decided to write the server simply by using the inetd.conf as a launcher and reading and writing to STDIN/OUT. Now : If I write my OWN programm with the socket unit and open a channel to the service running on say port 500 what port do I listen to and open to receive the answering connection? Or how do I tell the inetd service im connecting to where I am listening?

These options are mutually exclusive: either you let inetd accept the connections and invoke your program, or your program binds to a port and listens itself for connections on it. The accept call returns the port number of the client in this case.

Inetd has no knowledge of your program if yo uuse the sockets unit, but if you use inetd your program has no knowledge of the remote port.

[]s, Fernando Lozano

Reply by email