Relative Content

Tag Archive for csockets

Unexpected error when using srt sockets ()

I have server and client connection with srt socket (by Haivision https://github.com/Haivision/srt).
The connection is established as expected, but then, when communication begins, an odd error appears.
My packet structure is-
width: 2 bytes
height: 2 bytes
image: widthheight3 (3 bytes, rgb, for each pixel)

C# Server socket crash when client socket disconnect during sending

I have a console application as server socket that broadcast messages to all connected clients as also console applications, where sometimes when one client is disconnected then the server process get crashed without even raising any exception while I have try/catch blocks everywhere, but it seems it is windows level error as it logs one error in the event viewer that is (Exception code: 0xc0000005), I noticed that if I just comment the socket Send line (in the code below) then the crash won’t happen anymore, where the Send method is inside a for loop that send messages to all client in milliseconds, so am just wondering how to manage this expected scenario that during sending to a client then the client is subject to disconnect, here is how my code looks like:

BeginAccept not calling back to end accept

So I’m trying to get a console app running where the server and client can message each other i had it working before but it was with blocking or synchronous lines like send or receive and i wanted to switch over to unblocking because either the client or server had to wait to receive a message to send one and it wasn’t practical so i started with BeginAccept to get a feel of how they work but my beginAccept isn’t calling back to the static void that has the endAccept for a proper connection

C# socket receiving incomplete data

I’m working on a server/client pair of apps which work together as a remote file explorer, like Filezilla.
TCP sockets are used for communication, and this is the central class both of them use to handle communication:

How to avoid read() command waiting for data at socket, even if it is connected?

I am pretty new to socket programming. I wanted to make a function which listens to a particular port and passes the incoming value to a pointer. I also wanted the function to return nothing in case of no values in the buffer or no connection. I manged to do the no connection part , But if a connection gets established and no new values are coming from the Client the read() command freezes.