tcpclient

how to detect tcp client connect to server in c++

放肆的年华 提交于 2019-12-13 12:50:55
问题 I have a tcp client/server, and I want to detect connection loss in client side; because my client have multiple interfaces and at a time I connected to server with one of them, I want to know how to detect connection loss in client side so that I could connect my tcp client with another interface to the server and if all of them are down I store my data in text files. I googled it and I already seen keep alive but it's not what I want. if it is important my project is in linux and code is in

How to detect a Socket Disconnect in C#

删除回忆录丶 提交于 2019-12-13 11:40:11
问题 I'm working on a client/server relationship that is meant to push data back and forth for an indeterminate amount of time. The problem I'm attempting to overcome is on the client side, being that I cannot manage to find a way to detect a disconnect. I've taken a couple of passes at other peoples solutions, ranging from just catching IO Exceptions, to polling the socket on all three SelectModes. I've also tried using a combination of a poll, with a check on the 'Available' field of the socket.

Tcp Listener and Client listening to specfic ip

被刻印的时光 ゝ 提交于 2019-12-13 07:58:27
问题 What i am trying to do is listen to a socket of 5000, which works perfectly with the code TcpListener listener = new TcpListener(IPAddress.Any, 5000); NetworkStream Network; TcpClient client; client = listener.AcceptTcpClient(); but when the server has two clients that connect to the server they both listen to the same message coming through as they are multi threaded, i dont want this to happen because with them reading each other they are removing bytes from the network stream. so my

C# Streaming video over NetworkStream / TCPClient

不问归期 提交于 2019-12-13 07:13:07
问题 I am sending a video feed from an Xbox Kinect from a client program to a server. I have everything working but the problem is the frame rate. I'm thinking what is happening is it is sending faster than it can read. So when it can't send anymore it stores what it is about to send and waits until there is room in the buffer. The reason I think this is what is happening is because I can see the memory usage of the program steadily growing. Also because when I watch the video feed, I see

TcpClient/Listener: Do I have to call Sockets.Close when my program ends?

一个人想着一个人 提交于 2019-12-13 07:00:56
问题 I'm using the TcpClient and TcpListener classes to establish a connection between two computers. I've read documentation and questions online, but can't seem to find the answer to this question: Is it necessary to call Sockets.Close() before the program ends, or will VB close all sockets which were opened by the program for me before it ends? In addition, what if the program crashes? From what I've seen, the suggested implementation of the TcpClient and TcpListener classes suggest closing the

Read from TcpClient.GetStream() without knowing the length

爱⌒轻易说出口 提交于 2019-12-13 06:29:53
问题 I'm working on a tcp base communication protocol . As i know there are many ways to determine when to end reading. Closing the connection at the end of the message Putting the length of the message before the data itself Using a separator; some value which will never occur in the normal data (or would always be escaped somehow) Typically i'm trying to send a file over the WiFi network (that may be Unstable and Low speed) Cause of RSA and AES communication I don't like to close the connection

.Net TcpClient and SmtpClient won't connect to my Smtp server

℡╲_俬逩灬. 提交于 2019-12-13 06:14:13
问题 I have a method that is supposed to connect to an Smtp Server to see if it is online. This method works when testing many mail servers, but not all of them. The code is below, however the failure happens on... client.Connect(strMailServer, intPort); ... before the logic of talking to the server even begins. It simply won't connect. I've made absolutely sure I'm connecting the the right IP and port (25), and I've used third party web sites like mxtoolbox to test the same server IP with success

Connecting to a TCP server via TcpClient through proxy

☆樱花仙子☆ 提交于 2019-12-13 04:38:31
问题 I want to connect a TCPServer (ip, port) through proxy. Connect to a TCP server via TcpClient through proxy In this question, StarkSoft library has been suggested but website of StarkSoft cannot be accessed. Is there another way to do it? 来源: https://stackoverflow.com/questions/17751835/connecting-to-a-tcp-server-via-tcpclient-through-proxy

Connection to ruby based server

别来无恙 提交于 2019-12-13 04:28:04
问题 I am developping an application in C# Net framework 2.0. It is basicly a application with a tcp client class. the application connects to my server which is a basic ruby tcp server it stays for 4 hours then get disconnected class TelnetConnection { TcpClient tcpSocket; int TimeOutMs = 400; static string host = null; static int prt = 0; static int timetorec = 10; //sec public TelnetConnection(string Hostname, int Port) { host = Hostname; prt = Port; try { tcpSocket = new TcpClient(Hostname,

Exception, but only on 3rd time - The IAsyncResult object was not returned from the corresponding asynchronous method on this class

家住魔仙堡 提交于 2019-12-13 02:14:46
问题 I have a legacy (2008) Windows service application (using System.ServiceProcess.ServiceBase) that I need to utilize in a slightly different way to how it's working now. At the moment it starts up and creates a TCPLISTENER on a specific port, for a client app to connect to (which it does once) in order to send/receive requests to the listening port. This all works fine. However, the adaptation requires use of a web app to connect to the listener port, then send/rcv as normal but after the