locked
[U8.1]: Few questions about sending TCP packets using StreamSocket.

    Question

  • Hi,

    I create a system for sending packets in LAN thought StreamSocket. I wonder, if I can use only one listener for 2 or more clients sending packet to one serwer?

    My second questions is I can check, if data send by serwer is received by client and how can I check timeout of connection?


    Tuesday, April 28, 2015 1:31 AM

Answers

  • Wireshark/ Network Monitor (tools) are only used for "analyzing" and checking what is happening over the network. If you notice that the network trace using any of the tools shows a TCP-RST, then your application will receive the TCP-RST in the form of a socket reset/disconnected error.

    If your "server" was a Windows socket based server then you will receive a Winsock error code: 10054/WSAECONNRESET: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx for the connection which was previously "accepted".


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Tuesday, May 19, 2015 1:05 AM
    Moderator

All replies

  • Yes, in a typical client/server scenario, your server (listener) starts the "Accept" loop to start listening on the socket for an incoming client connection (could be multiple clients connecting at the same time) and starts processing any new client connection when one is received.

    The "meaning" of a timeout is implemented by the client or the server. For example, if your client opens a connection with the server and does not do anything with the opened connection (does not send any data), then your server should have some mechanism of "aborting" the socket and thus implement a "timeout".


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Tuesday, April 28, 2015 7:20 PM
    Moderator
  • Thanks for help, I wonder, when I have connection and it is a way to check, whenether the client is disconnected from server, for example in cause of app crash without sending testing packets for every 5 seconds. Maybe it is a way to send "critical message", when the app crash or closed immediately in Windows Store apps?
    Monday, May 11, 2015 1:17 AM
  • If the app crashes without properly terminating the TCP connection your server should receive a TCP-RST indicating the forceful shutdown of the TCP connection.

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Monday, May 11, 2015 4:45 PM
    Moderator
  • Ok, I what way can I check, if my server get this tcp reset packet?
    Tuesday, May 12, 2015 1:14 AM
  • You can collect a network trace on your server using tools such as Network Monitor/Wireshark to analyze the network traffic.

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Tuesday, May 12, 2015 6:37 PM
    Moderator
  • How can I do it, because wireshark is a separate program and I cannot directly get info from it?
    Thursday, May 14, 2015 1:28 AM
  • Wireshark/ Network Monitor (tools) are only used for "analyzing" and checking what is happening over the network. If you notice that the network trace using any of the tools shows a TCP-RST, then your application will receive the TCP-RST in the form of a socket reset/disconnected error.

    If your "server" was a Windows socket based server then you will receive a Winsock error code: 10054/WSAECONNRESET: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx for the connection which was previously "accepted".


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Tuesday, May 19, 2015 1:05 AM
    Moderator