CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2014
    Posts
    1

    Post Facing Problem in Socket Programming with C# .Net

    Hi,

    I have a server application and receiving data very speedy from different clients (Round about 300), I have build application using Socket Programming with C# .Net. The basic functionality of server application just receive data and store in database as it is. But there are some error occurred and due to these error my application CRASH. Errors are mentioned below:

    1.
    OnClientConnect
    SocketException Info : Message [An existing connection was forcibly closed by the remote host]. StackTrace [ at System.Net.Sockets.Socket.EndAccept(Byte[]& buffer, Int32& bytesTransferred, IAsyncResult asyncResult)
    at System.Net.Sockets.Socket.EndAccept(IAsyncResult asyncResult)
    at SH.Tracking.ServerApp.frmGPRSServer.OnClientConnect(IAsyncResult asyn) in ServerApp\frmServer.cs:line 124]


    2.
    OnClientConnect
    SocketException Info : Message [Cannot access a disposed object.
    Object name: 'System.Net.Sockets.Socket'.]. StackTrace [ at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
    at SH.Tracking.ServerApp.frmGPRSServer.CloseClientSocket(Socket objSocket) in ServerApp\frmSServer.cs:line 211]


    3.
    OnClientConnect
    Exception Info : Message [Collection was modified; enumeration operation may not execute.]. StackTrace [ at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
    at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
    at System.Collections.Generic.List`1.Enumerator.MoveNext()
    at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
    at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
    at SH.Tracking.ServerApp.frmGPRSServer.OnClientConnect(IAsyncResult asyn) in ServerApp\frmSServer.cs:line 135]


    4.
    WaitForData
    SocketException Info : Message [An existing connection was forcibly closed by the remote host]. StackTrace [ at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
    at SH.Tracking.ServerApp.frmGPRSServer.WaitForData(Socket objsoc, Int32 intClientNumber) in ServerApp\frmSServer.cs:line 242]

    I am so worried, Please share your valueable comments to get rid of these errors.

    Thanks & Regards;
    MIA

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured