Top.Mail.Ru Yandeks.Metrika
Forum: "Networks";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];


socket Find similar branches

anmak   (2001-11-02 16:49) [0]

How to resume a dead socket?

There is a piece of code that is breaking off.

FD_ZERO (fds);
FD_SET (S, fds);
case select (S + 1, @ fds, nil, nil, @ one_second) of
SOCKET_ERROR: // error detected
__close (s);
writeln ("server down");
halt (1);

Here's how instead
__close (s);
writeln ("server down");
halt (1);

make the server work again without nezavalivaya uz snatched connections.

Digitman   (2001-11-05 12:50) [1]

After __close (s) (it is necessary to understand, does CloseSocket (s) occur in it?) There can be no talk of “reanimation” of the current connection with the client - you yourself broke the connection with the client without understanding the true causes of SOCKET_ERROR. Nowhere in this code is there any analysis of the reasons for the error that occurred (see WSAGetLastError).
And in general, it is not clear why the server process should be terminated if there was only a non-critical failure in communication with one of the clients (some other active clients are to blame for the server, that it "throws" all of them at once due to a break in communication with some then one?)

anmak   (2001-11-05 14:12) [2]

yes really .. why?
thank you very much

KPOT   (2002-01-22 13:59) [3]

Pishu malen "kuju programmku s Socketami, niznaju kak pral" na dejstvovat "v takoj situacii:

inogda na onReceive Socket.ReceiveLength bol "she chem vozvrachaemoje znachenie Socket.ReceiveBuf. Ja tak ponimaju chto znachit prislali mne bol" she chem ja s4ital: (((

Kak i kogda ja mogu s4itat "ostatok ???

Zaranee blagodaren

Digitman   (2002-01-22 14:22) [4]

if there is a remainder, the OnRead () event will occur again. In its handler, read the next expected portion, no larger than ReceiveLength. That is, whenever an OnRead () event occurs, the system informs you about the availability in the receive buffer of the data socket that was actually received from the connection partner at that time, the size of ReceiveLength bytes. You yourself at this particular moment (the moment of processing the OnRead event) are free to decide on what portion of the required size you need to read from the buffer (but no more than ReceiveLength bytes)

Pages: 1 whole branch

Forum: "Networks";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];


Memory: 0.55 MB
Time: 0.027 c
2002-03-06 11:33

2002-03-10 16:35
How to programmatically obtain data on the file version?

2002-03-10 14:02
Very much necessary! Do not refuse!

2002-03-05 19:22
How to work with BLOB using UPDATE?

2002-01-16 11:10
What do you eat type TRASConn with?

afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
English French German Italian Portuguese Russian Spanish