Sign in Join

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

Mailing lists / fpc-pascal / 2016-10

Socket pair

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Santiago A.

I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair returns always -1.

How do you get the in and out streams when a server accepts a new client connection? I have seen some server examples, like isocksrv.pp, but only read from client and send nothing back to client.

can anyone point and example with pair of sockets or bidirectional connection communication?

Saludos Santiago A.
Rainer Stratmann
to Santiago A.

There is fpaccept

http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html

But in the example accept is used ... (?!)

Santiago A. wrote 18 lines
I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair returns always -1. How do you get the in and out streams when a server accepts a new client connection? I have seen some server examples, like isocksrv.pp, but only read from client and send nothing back to client. can anyone point and example with pair of sockets or bidirectional connection communication? -- Saludos Santiago A. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Michael Van Canneyt
to Rainer Stratmann
Rainer Stratmann wrote 5 lines
There is fpaccept http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html But in the example accept is used ... (?!)

Can you please report this in the bugtracker so I do not forget to correct this ?

Michael.

Show quoted text 26 lines
Am Montag, 3. Oktober 2016, 10:27:55 schrieb Santiago A.: > I've seen that "accept" functions with socket pairs are deprecated. And > fpsocketpair returns always -1. > > How do you get the in and out streams when a server accepts a new > client connection? I have seen some server examples, like isocksrv.pp, > but only read from client and send nothing back to client. > > can anyone point and example with pair of sockets or bidirectional > connection communication? > > > -- > Saludos > Santiago A. > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Michael Van Canneyt
to Santiago A.: I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair…
Santiago A. wrote 9 lines
I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair returns always -1. How do you get the in and out streams when a server accepts a new client connection? I have seen some server examples, like isocksrv.pp, but only read from client and send nothing back to client. can anyone point and example with pair of sockets or bidirectional connection communication?

The same socket descriptor (stream, if you want) can be used for reading and writing. The descriptor uses different buffers for read and write operations.

I will try to extend the sample programs so this is made more clear.

Michael.

Paul Breneman
to Santiago A.: I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair…
Santiago A. wrote 9 lines
I've seen that "accept" functions with socket pairs are deprecated. And fpsocketpair returns always -1. How do you get the in and out streams when a server accepts a new client connection? I have seen some server examples, like isocksrv.pp, but only read from client and send nothing back to client. can anyone point and example with pair of sockets or bidirectional connection communication?

Thanks for reminding me about a socket (and serial) echo example that I wrote for a work project six months ago. I'll try to release it here in the next day or two:
http://ctrlterm.com/custom.htm

Regards,
Paul
www.ControlPascal.com

Mark Morgan Lloyd
to Michael Van Canneyt: The same socket descriptor (stream, if you want) can be used for reading and writing. The…
Michael Van Canneyt wrote 11 lines
On Mon, 3 Oct 2016, Santiago A. wrote: > can anyone point and example with pair of sockets or bidirectional > connection communication? The same socket descriptor (stream, if you want) can be used for reading and writing. The descriptor uses different buffers for read and write operations. I will try to extend the sample programs so this is made more clear.

What would be useful in that example would be extracting the IP address of the server, not just of the client. However when I look at the usage of Accept() I can't help but notice that it doesn't match what's described at the top of the page.

http://www.freepascal.org/docs-html/current/rtl/sockets/fpaccept.html

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Paul Breneman
to Paul Breneman: Thanks for reminding me about a socket (and serial) echo example that I wrote for a work…
Paul Breneman wrote 19 lines
On 10/03/2016 03:27 AM, Santiago A. wrote: > I've seen that "accept" functions with socket pairs are deprecated. And > fpsocketpair returns always -1. > > How do you get the in and out streams when a server accepts a new > client connection? I have seen some server examples, like isocksrv.pp, > but only read from client and send nothing back to client. > > can anyone point and example with pair of sockets or bidirectional > connection communication? Thanks for reminding me about a socket (and serial) echo example that I wrote for a work project six months ago. I'll try to release it here in the next day or two: http://ctrlterm.com/custom.htm Regards, Paul www.ControlPascal.com

Just released. Comments and feedback welcome!