tcpclient

[.NET] BeginReceive / BeginRead timeouts

I'm using a NetworkStream & TcpClient to asynchronously receive data using BeginRead. I need to apply a time-out to this operation, such that after a specified amount of time the read will be aborted. As far as I'm able to tell, this isn't supported on NetworkStream or TcpClient - there is a ReceiveTimeout property, but this appears to...

Socket not registering when the other end is closed.

I'm working on a client/server application where the connections from the client to the server stay open until the client application is closed. If the server application goes down unexpectedly, while the client is reading data, I want the client to treat this as an exception, but then to catch the exception and raise an event with the ...

VB.NET writing a telnet client using system.net.tcpclient

This isn't working for me when I connect to my solaris box The server is sending back ??% does anyone know what i'm doing wrong Imports System.Net Imports System.Net.Sockets Imports System.Text Public Class TelnetClient Private _hostname As String = "myserver" Private _username As String = "user" ...

How do I continually monitor for new TCP clients?

I have a TCP server that continually monitors for new incoming clients asynchronously and adds them to a client list: public class TcpServer { public List<TcpClient> ClientsList = new List<TcpClient>(); protected TcpListener Server = new TcpListener(IPAddress.Any, 3000); private _isMonitoring = false; public TcpServer()...

Sending large objects over TCP: "End of Stream encountered before parsing was completed"

I keep getting an SerializationException whenever I try to deserialize a list of doubles from a NetworkStream: End of Stream encountered before parsing was completed I have a simple client server architecture: my TcpTransportClient wraps the functionality of a TcpClient and I utilize two basic methods: Send (sends a message) and...

TcpClient send data and receive data over network

I am a newbie on socket programming. I need to develop a service that will connect to a TCP server. Main tasks are reading incoming messages and also sending commands to the server in ten minutes, like a synchronize command. E.g. I used the TcpClient object as shown below: ... TcpClient tcpClient = new TcpClient(); tcpClie...

Multiple simultaneous tcp client connections for performace test

Hi i need to create multiple TCP connections simultaneously to some custom TCP-server application for its performance testing. I know a lot of such for Web (i.e. curl-loader based on libcurl), but I didn't found some general one. Scenario for client is the simplest: create connection, send special data, read the answer and close connecti...

sending ushort ulong byte data over tcpclient object

Hello ,My application in c# wants to cominicate with 3rd party Tcp server to send data and recieve back response messages ...The syntax of commands has UShort,ULONG,BYTE type datas a sample command that needed to send by my app is USHORT 0xFFFF USHORT 0x00D0 BYTE 0xDD then in app i send data as TcpClient tcpClient = new TcpClien...

How can I connect to a TCP server using Silverlight?

I'm learning silverlight programming as well as networking and I was using this tutorial: http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server However in it it says to connect to a server you must create an instance of TcpClient, in my server side code which uses the forms application I have access to TcpC...

Transfering a File with a NetworkStream then rebuilding the file fails.

I am trying to send a file over a NetworkStream and rebuild it on the client side. I can get the data over correctly (i think) but when I use either a BinaryWriter or a FileStream object to recreate the file, the file is cut off in the beginning at the same point no matter what methodology I use. private void ReadandSaveFileFromServe...

Transfering items over NetworkStream causes some data to get clobbered

I am sending a filename(string), filesize(int), and the file(byte[]). What is happening is that in certain cases, depending on how quickly the data gets processed on the server side, the NetworkStream has read the data that I dont need yet. Example: I do a .Read to get the filename, I will get the data for filename,filesize and the fi...

Disconnecting TCPClient and seeing that on the other side.

i am trying to disconnect a client from a server but the server still sees it as being connected. I cant find a solution to this and Shutdown, Disconnect and Close all dont work. Some code for my disconnect from the client and checking on the server: Client: private void btnDisconnect_Click(object sender, EventArgs e) { ...

Hold TcpClient Connection with WCF

Hallo I need a Tcp connection to a server alive in backgrond and applications will send data with this connection.I searched around and found WCF singleton is apporiate for this task here is a code snippet that i use below my question is that the good way and any problem can be with this? string hostAddress = string.Empty; ...

What's the best way to handle multiple outgoing connections in Perl?

I have three TCP servers I need to connect to, each with different protocols, but all in nonblocking mode. Right now my plan is essentially opening a new IO::Socket per each one and adding them to IO::Select, then looping through can_read(). The idea is based on how servers are usually written in Perl, but it seems like it could work for...

How to terminate async read from SslStream?

I use SslStream with TcpClient in following way: I call BeginRead() method and waiting for its results. When results come, I read them, call BeginRead() again and so on... Sometimes I need create another SslStream with this TcpClient, i.e. perform another ssl handshake. How can I abort reading execution? It seams that if I try to cal...

C# - TCP/IP MIB-II (RFC-1213) Group Support

Group, Is there group support for TCP/IP MIB-II (RFC-1213) in C#. I'm trying to write a client interface that will communicate over SNMP and access data dictionaries plus files. --Looking on the internet. It seems to me that I'll need a SNMP agent. Any suggestions or help. Chad ...

TcpClient vs MSMQ

I'm developing an application that will need to communicate with itself running on different machines located in different locations. I was going to use TcpListener and TcpClient to send information between applications but then I came across MSMQ. The computers are connected via software VPN, which communicates across my standard inte...

How to capture TCP fragmentation in linux

I want to capture the tcp fragmentation packets using wireshark. I wrote a tcp client and a tcp server. I have set MTU to 500, MSS to 1500. Also I have set IP_MTU_Discouver to IP_PMTUDISC_DONT. The send/receive buffer size is 1448 and the input file to the client is 15kb. But I cannot capture any fragmentation. What's the problem? Thank...

C# - The best way to test TCP client (Using Sockets Helper Class)

Any suggestions on testing a TCP client listener. What I'm looking for is actual network stats like "payload size", "time-out values", "actual payload bytes received from server". public static void tcpConnect() { int port = 12345; IPEndPoint ipep = new IPEndPoint( IPAddress.Parse("xx.xx.xx....

Twisted threaded tcp client

Hi there. I am trying to write a simple TCPServer and a client with Twisted python. Everything is working well; but, there is a way to defer some tasks to different threads? For example, is it possible to do: take an input from the user until \n, then send the data to the server; accept all the incoming messages from the server and wri...