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

Down

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
begin
__close (s);
writeln ("server down");
halt (1);
end;

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];

Top









Memory: 0.56 MB
Time: 0.031 c
We answer immediately.
narik
2002-03-10 17:13
2002.04.01
Quick report


We answer immediately.
Dok_3D
2002-03-19 07:28
2002.04.01
Large XML files


We answer immediately.
KaPaT
2002-01-20 01:39
2002.04.01
Very simple question!


We answer immediately.
madburro
2002-02-15 22:47
2002.04.01
Optical mouse


We answer immediately.
vlad451
2002-03-20 10:30
2002.04.01
DLL





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 Español 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
zulu
English French German Italian Portuguese Russian Spanish