C#: SMTP-server - time to get a team
-
Situation: My SVP server is connected to a client.EHLOfurther dialogueMAIL,RCPT,BDATlater, goodbyeQUIT) In time, the client (this) reconnects, I don't know why I don't give any team.I'm showing up. Client expectations of the team♪
Question:
What is the right thing to do in this case:
- Keep waiting for the client team?
- Cutting the connection with this client? or something?
Thank you.
Here's the customer data collection code (clinical teams):
private string ReadLine() { try { while (true) { if (clientSocket.Available > 0) { byte[] currByte = new byte[1]; int countRecieved = clientSocket.Receive(currByte, 1, SocketFlags.None);
///.. код обработки команды и отправка ответа клиента } else { l.Write("clientSocket.Available: " + clientSocket.Available.ToString()); //---- Time out stuff -----------------------// if (DateTime.Now.Ticks > lastDataTime + ((long)(60000)) * 10000) { l.Write("ERROR: Read timeout: " + (((long)(60000)) * 10000).ToString()); // throw new Exception("Read timeout"); // return ""; // ??? } System.Threading.Thread.Sleep(100); //------------------------------------------// } } } catch (Exception x) { l.Write("EROR ReadLine(): " + x.ToString()); throw new Exception( x.Message); }
-
Well, IMOW, there's no clear correct answer to this question. Much depends on the context of the server.
I'd offer to break the connection if the silence didn't start the dialog in a certain time. Otherwise, DOS/DDOS could be attacked by your server by connecting a large number of silent clients to your server. And even if you have a lot of memory and all the objects of the active bonds you keep, you'll have enough of your silence to start a dialogue at the same time.