N
Nuno Magalhaes
In a simple code I do something like this in a synchronous connection:
-*server*-----------------------------
ClientTcp=ListenerTcp.AcceptTcpClient();
NetworkStream nstream=ClientTcp.GetStream();
ImagePictureBox.Image.Save(nstream,System.Drawing.Imaging.ImageFormat.Jpeg);
nstream.Close();
If I don't close the underlying socket with nstream.Close() de image
never gets to the client. Why does this occur since nstream is
unbuffered it should get to the client. In the client I do something
like this:
-*client*----------------------------
NetworkStream nstream=ClientTcp.GetStream();
//Get image data as JPEG
ImagePictureBox.Image=Image.FromStream(nstream);
nstream.Close();
The image never gets to client if I don't close the socket in the
server but this forces me to establish connections after connections
and it gets slow. Should I move to asynchronous socket connections...
does this problem persists in asynchronous mode? If I want to get an
image passed to the client I have to make the client acknowledge the
server at the end of image... and also have to read the bytes
asynchronously using this format: |Size|Byte Data|.
Any lights on this would be great,
Nuno Magalhães.
-*server*-----------------------------
ClientTcp=ListenerTcp.AcceptTcpClient();
NetworkStream nstream=ClientTcp.GetStream();
ImagePictureBox.Image.Save(nstream,System.Drawing.Imaging.ImageFormat.Jpeg);
nstream.Close();
If I don't close the underlying socket with nstream.Close() de image
never gets to the client. Why does this occur since nstream is
unbuffered it should get to the client. In the client I do something
like this:
-*client*----------------------------
NetworkStream nstream=ClientTcp.GetStream();
//Get image data as JPEG
ImagePictureBox.Image=Image.FromStream(nstream);
nstream.Close();
The image never gets to client if I don't close the socket in the
server but this forces me to establish connections after connections
and it gets slow. Should I move to asynchronous socket connections...
does this problem persists in asynchronous mode? If I want to get an
image passed to the client I have to make the client acknowledge the
server at the end of image... and also have to read the bytes
asynchronously using this format: |Size|Byte Data|.
Any lights on this would be great,
Nuno Magalhães.