Hallo!
I want to use the TInetServer or the ssocket.
I see the example applications, but I don't understand. I can use the destroy, but If I create the server socket on a port xxx how catch the client socket?
So I want to give a socket into variable.
Somebody can help me???
Thanx.
Cow
Mailing lists / fpc-pascal / 2001-01
Server
15 messages · 8 people · –
- Bboci 5
- FFPC Mail list reader 4
- AAndrey Kubyshev 1
- BBrad Campbell 1
- PPeter Vreman 1
- SSebastian Günther 1
- +2 more
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Halley!
So.
I want to write a server (associated to a port) on the basic packages. It's possible?
I see the documentation, and I found a socket library. In the documentation have an example, how to write an unix domain socket. I want to write an internet socket, but I didn't find Accept and other function, where the parameter is the port. I found only the fcl library, but I want to use a protable solution. The sscoket library doesn't work on windows system, but all system contain the socket unit. And I see, the unit constants and i found AF_INET and PF_INET socket type.
Cow.
Try using just the fns in sockets.pp,you have there (almost) all you need; in order to…
you wrote 5 lines
Ok, but how.
Can you tell me an example?
Cow
Try using just the fns in sockets.pp,you have there (almost) all you need; in order to use accept() , you need to bind the socket and you can specify the port in the bind() call.
Bogdan.
Halley! So. I want to write a server (associated to a port) on the basic packages. It's…
Hello boci,
boci> So.
boci> I want to write a server (associated to a port) on the basic packages. boci> It's possible?
boci> I see the documentation, and I found a socket library. In the documentation boci> have an example, how to write an unix domain socket. I want to write an boci> internet socket, but I didn't find Accept and other function, where the boci> parameter is the port. I found only the fcl library, but I want to use a yes, its possible but it will not be really "stable server" i write simplest http server .. it works good but maybe for example on 5000th thread it crashes (i use pthread coz native thread is not good for that)
Andrey Kubyshev wroteHello boci,
yes, its possible but it will not be really "stable server" i write
Show quoted text 6 lines
Having written several "Servers" used on a daily basis with FPC, I believe the problems you have are related to your use of Threads.. If you write a server based on either select() or fork() I believe you will not have this problem. Please stop telling people FPC is no good for writing servers.. You are wrong.. It may, however, be unsuitable for writing multi-threaded applications at the moment due to the non-reentrancy of the fcl.. (and rtl?) ..
boci> So. boci> I want to write a server (associated to a port) on the basic packages.…
yes, its possible but it will not be really "stable server" i write simplest http server .. it works good but maybe for example on 5000th thread it crashes (i use pthread coz native thread is not good for that)
Ok, but how! Pleeeeeease, how? I want, but I didn't find documentation..... Or example..... Please send me, how?
Thanx
Cow.
yes, its possible but it will not be really "stable server" i write Having written…
Having written several "Servers" used on a daily basis with FPC, I believe the problems you have are related to your use of Threads.. If you write a server based on either select() or fork() I believe you will not have this problem.
But how can you, for example, do a server which can service more than 256 connections at the same time with select() ? If i'm not wrong, the fdset type only allows checking for 256 descriptors ...
Bogdan
try the attachment as a template; all it does is bind the socket, allow one connection,…
Thanx the file.
I see your code, and the socketex file, but...
Only one question.
so I accept a socket in to a longint (???). After I give the socket (so, the longint), to the thread (But the socket not disconnected?). After I waiting the another socket (Rigth?).
Cow.
Ok, but how! Pleeeeeease, how? I want, but I didn't find documentation..... Or…
boci wroteOk, but how! Pleeeeeease, how? I want, but I didn't find documentation..... Or example..... Please send me, how? Thanx Cow.
try the attachment as a template; all it does is bind the socket, allow one connection, send a message, wait for one and then exit. if you want to do a server that actually works, try the serverex example( located in <ppdir>\source\docs\sockex\serverex.pp . It'll show you how to accept more connections at the same time, plus other things you need to know.
Bogdan.
But how can you, for example, do a server which can service more than 256 connections at…
Oh, i'm very sorry, but i forgot to add the attachment for the last reply to "Re: Server". So here it is ... again, a thousand pardons ...
But how can you, for example, do a server which can service more than 256 connections at…
FPC Mail list reader wroteBut how can you, for example, do a server which can service more than 256 connections at the same time with select() ? If i'm not wrong, the fdset type only allows checking for 256 descriptors ...
With a standard kernel, yes. But it's possible to increase this number in the kernel. IIRC there has been some talk about this in the Linux kernel mailing list some time ago...
- Sebastian
Show quoted text 10 lines
When you strace your program under linux it always shows 'old_select'. So there should already be a new select syscall
With a standard kernel, yes. But it's possible to increase this number in the kernel.…
Show quoted text 9 lines
Or you can use 'poll' which does the same as 'select' only it can handle an infinite amount (well, as much filedescriptors as Linux has) of file descriptors.
Michael.
Ok, but how. Can you tell me an example? Cow
Hallo,
boci wrote 6 lines
You can find a small tutorial on simple client and server programs at: http://www.bastisoft.de/pascal/pasinet.html
HTH,
- Sebastian
