networkstream Questions

5

Solved

I would like to be able to get the length of the data available from a TCP network stream in C# to set the size of the buffer before reading from the network stream. There is a NetworkStream.Length...
Anterior asked 15/10, 2013 at 18:2

5

Solved

Currently, there isn't a NetworkStream.Peek method in C#. What is the best way of implementing such a method which functions just like NetworkStream.ReadByte except that the returned byte is not ac...
Contaminate asked 4/2, 2010 at 1:20

10

Solved

I'm playing around with the TcpClient and I'm trying to figure out how to make the Connected property say false when a connection is dropped. I tried doing NetworkStream ns = client.GetStream(); ...
Horwitz asked 7/9, 2009 at 3:41

8

Solved

So, it would seem that a blocking Read() can return before it is done receiving all of the data being sent to it. In turn we wrap the Read() with a loop that is controlled by the DataAvailable valu...
Shotwell asked 23/11, 2010 at 21:56

2

Solved

When reading C# NetworkStream (from stream-type TCP socket), BinaryReader.ReadChar occasionally throws exceptions System.ArgumentException: The output char buffer is too small to contain the decode...
Helot asked 30/8, 2013 at 10:21

8

Solved

I am trying to read all data present in the buffer of the Machine connected through TCP/IP but i don't know why i am not getting all data ,some data is getting Missed. Here is the code that i am us...
Littoral asked 26/9, 2014 at 11:34

3

Solved

I have a worker thread in my application that is responsible for three different things. Requests for two of the jobs turn up in Queues that I have written, the other job is activated when a reques...
Mistook asked 1/9, 2009 at 10:29

1

I have following method code in my Xamarin.Forms application using (TcpClient client = new TcpClient(ip, port)) using (NetworkStream stream = client.GetStream()) { byte[] messageBytes = PrepareM...
Catechumen asked 21/2, 2019 at 20:58

1

Solved

I am using a NetworkStream to keep an open TCP/IP connection that messages can be sent across. I receive a message, process it, and then return an ACK. I am working with a site where occasionally I...
Rattat asked 3/4, 2018 at 0:9

2

Solved

I just need to read up to N bytes from a SslStream but if no byte has been received before a timeout, cancel, while leaving the stream in a valid state in order to try again later. (*) This can be...
Teufert asked 12/5, 2016 at 4:39

2

Solved

I'm trying to read data from NetworkStream. I write next code: Imports System.Net Imports System.Net.Sockets Public Class Form1 Dim tcpclnt1 As New TcpClient Dim streamTcp1 As NetworkStream Di...
Giovanna asked 29/3, 2017 at 14:49

3

Solved

I am trying to use NetworkStream.ReadAsync() to read data but I cannot find how to cancel the ReadAsync() once called. For background, the NetworkStream is provided to me by a connected BluetoothCl...
Erin asked 7/3, 2013 at 14:28

1

I have an app that uses a TCP socket to exchange byte arrays which in most cases contain JSON string data. What I'm experiencing is that, for larger messages and less than ideal network conditions,...
Jae asked 19/4, 2016 at 23:30

2

Solved

I am using a networking protocol built around TcpClient, using BinaryReader to read bytes from the underlying NetworkStream (and, conversely, using BinaryWriter to write). The protocol transmits s...

4

Solved

MSDN documentation seems to suggest that NetworkStream.Read will always return immediately. If no data is found it returns 0. However, I have some code that is currently deployed, that only in some...
Minardi asked 5/8, 2011 at 14:52

3

Solved

I have a c# application that I use a custom FTP library for. Right now Im using Socket.Send to send the data but I was wondering if it would be better to initiate a NetworkStream with the socket an...
Hogen asked 2/7, 2011 at 3:54

1

Solved

I have a thread writing requests to NetworkStream. Another thread is reading responses from this stream. I want to make it fault tolerant. In case of network failure, I want NetworkStream to be di...
Please asked 7/9, 2015 at 4:41

1

Solved

I created a simple persistent socket connection for our game using TcpClient and NetworkStream. There's no problem connecting, sending messages, and disconnecting normally (quitting app/server shut...
Caning asked 9/7, 2015 at 16:4

2

Solved

I am trying to create a server that can accept both secure SSL and insecure plain text connection (for backwards compatibility). My code is almost working except the first transmitted data received...
Countless asked 5/3, 2013 at 15:21

1

Solved

I don't quite 'get' async and await yet, and I'm looking for some clarification around a particular problem I'm about to solve. Basically, I need to write some code that'll handle a TCP connection....
Edify asked 30/10, 2014 at 11:55

2

Solved

I'm currently working with tcp/ip suite. I'm writing a program to encrypt files at sender's end and decrypt at receiver's side. I came across this exception while initializing my byte array with th...
Append asked 27/4, 2014 at 9:26

1

Solved

I'm trying to get data from a medical BT device that I already have pairing code and communication protocol. Looking for some code I've got this code: using System; using System.Collections.Gener...
Boldfaced asked 26/3, 2014 at 17:38

1

Solved

I tried to understand the MSDN example for NetworkStream.EndRead(). There are some parts that i do not understand. So here is the example (copied from MSDN): // Example of EndRead, DataAvailable ...
Tews asked 1/10, 2013 at 9:46

3

Solved

i'm having the the post's title error when trying to write a file on a window folder , mounted on unix system. I've developed a web service which runs inside a Tomcat 6 on a linux os and need to wr...
Juttajutty asked 9/2, 2011 at 11:16

4

Solved

I have a project where I'm trying to send a serialized object to the server, then wait for an "OK" or "ERROR" message to come back. I seem to be having a similar problem to th p...
Searby asked 15/2, 2011 at 18:51

© 2022 - 2024 — McMap. All rights reserved.