Click here to Skip to main content
15,310,056 members
Home / Discussions / C#
   

C#

 
AnswerRe: X Number Of Results Per Line Pin
MadDashCoder18-Mar-16 12:44
MemberMadDashCoder18-Mar-16 12:44 
AnswerRe: X Number Of Results Per Line Pin
Richard Andrew x6418-Mar-16 12:42
professionalRichard Andrew x6418-Mar-16 12:42 
AnswerRe: X Number Of Results Per Line Pin
Sascha Lefèvre18-Mar-16 14:45
professionalSascha Lefèvre18-Mar-16 14:45 
GeneralRe: X Number Of Results Per Line Pin
Brisingr Aerowing18-Mar-16 15:08
professionalBrisingr Aerowing18-Mar-16 15:08 
GeneralRe: X Number Of Results Per Line Pin
Luc Pattyn19-Mar-16 14:12
sitebuilderLuc Pattyn19-Mar-16 14:12 
GeneralRe: X Number Of Results Per Line Pin
Brisingr Aerowing19-Mar-16 20:30
professionalBrisingr Aerowing19-Mar-16 20:30 
AnswerRe: X Number Of Results Per Line Pin
Richard Deeming21-Mar-16 2:50
mveRichard Deeming21-Mar-16 2:50 
QuestionSocket closing without FIN from peer Pin
MidwestLimey17-Mar-16 9:39
professionalMidwestLimey17-Mar-16 9:39 
I've got an oddball issue I'm troubleshooting. I have a heavy duty data exchange service (windows service hosted in a data center) currently routing data requests from about 120 clients. Any individual client has about 5-15 other clients able to query them. At any given time around 100 or so will be connected, each with a single socket to the exchange service. Most client connection come in from the internet (a few are also hosted at the same data center).

The behaviour I'm observing is that frequently the service will carry out a formal disconnect (exchange terminate messages, and then close the socket) from the client after being connected for less than 10 seconds. Tracking it down I've identified the problem to the EndRead method below. I have the socket managed by custom implementation of Stream.

C#
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) {
    if (null != _socket && _socket.Connected)
        return _socket.BeginReceive(buffer, offset, count, SocketFlags.None, callback, state);
    else
        return null;
}

public override int EndRead(IAsyncResult asyncResult) {
    int result = -1;
    if (null != _socket && _socket.Connected) {
        try { result = _socket.EndReceive(asyncResult); } catch (ObjectDisposedException) { }
    }
    return result;
}



One of two things are happening (my logging didn't track which). Either _socket.Connected is false, or _socket.EndReceive is throwing ObjectDisposedException, since -1 is returned.
Wireshark captures from both the server and client sides show no FIN or RST was ever sent by the client prior to the formal disconnect, instead the disconnect is incidentally caused by Dispose logic once the read fails. Since the connection is in fact still active the terminate message is sent and responded to. If any other exception was thrown it would have been captured and logged. The read that fails is the first of 3 reads for a complete message (being Header, payload length and payload), nor does the Wireshark trace show any message attempted immediately before the disconnect. The last client message was appropriately responded to by the service.

Any one have any hints on where to go hunting for answers?

Addendum: This is TCP.
062142174041062102


modified 17-Mar-16 15:54pm.

AnswerRe: Socket closing without FIN from peer Pin
Fueled By Decaff18-Mar-16 3:52
MemberFueled By Decaff18-Mar-16 3:52 
GeneralRe: Socket closing without FIN from peer Pin
MidwestLimey18-Mar-16 14:17
professionalMidwestLimey18-Mar-16 14:17 
QuestionHow can i create a dialog box window in asp.net C# (web) which contains many field? Pin
Hameed Khan17-Mar-16 5:35
MemberHameed Khan17-Mar-16 5:35 
AnswerRe: How can i create a dialog box window in asp.net C# (web) which contains many field? Pin
OriginalGriff17-Mar-16 6:28
mveOriginalGriff17-Mar-16 6:28 
SuggestionRe: How can i create a dialog box window in asp.net C# (web) which contains many field? Pin
Richard Deeming17-Mar-16 6:58
mveRichard Deeming17-Mar-16 6:58 
GeneralRe: How can i create a dialog box window in asp.net C# (web) which contains many field? Pin
OriginalGriff17-Mar-16 7:10
mveOriginalGriff17-Mar-16 7:10 
QuestionRe: How can i create a dialog box window in asp.net C# (web) which contains many field? Pin
ZurdoDev17-Mar-16 10:15
professionalZurdoDev17-Mar-16 10:15 
AnswerRe: How can i create a dialog box window in asp.net C# (web) which contains many field? Pin
F-ES Sitecore18-Mar-16 0:37
professionalF-ES Sitecore18-Mar-16 0:37 
QuestionTime Elapse Pin
Aelmfr16-Mar-16 13:57
MemberAelmfr16-Mar-16 13:57 
AnswerRe: Time Elapse Pin
Garth J Lancaster16-Mar-16 14:30
professionalGarth J Lancaster16-Mar-16 14:30 
GeneralRe: Time Elapse Pin
Aelmfr16-Mar-16 14:46
MemberAelmfr16-Mar-16 14:46 
AnswerRe: Time Elapse Pin
Patrice T16-Mar-16 14:37
mvePatrice T16-Mar-16 14:37 
GeneralRe: Time Elapse Pin
Aelmfr16-Mar-16 14:53
MemberAelmfr16-Mar-16 14:53 
GeneralRe: Time Elapse Pin
Patrice T16-Mar-16 15:08
mvePatrice T16-Mar-16 15:08 
GeneralRe: Time Elapse Pin
Aelmfr16-Mar-16 15:44
MemberAelmfr16-Mar-16 15:44 
GeneralRe: Time Elapse Pin
Patrice T16-Mar-16 15:58
mvePatrice T16-Mar-16 15:58 
GeneralRe: Time Elapse Pin
Garth J Lancaster16-Mar-16 16:06
professionalGarth J Lancaster16-Mar-16 16:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.