tcpclient

How do you get the IP address of a server (not a webserver) but a TCP server created on a wifi module in Xamarin.Forms

心不动则不痛 提交于 2019-12-08 11:42:16
问题 I need to get the IP address of a Wi-Fi module, running a TCP server. The application will open the WiFi connections settings page to allow the user to connect to the Wi-Fi module's created network (requiring the password to be entered)- see attached picture . The server (Wi-FI module) IP address is 172.1.4.155 (for example) but when I try to get the IP address in Xamarin.Forms using GetLocalIPAddress() (attached below), the address it returns is the local IP address of the device (Phone)-

TcpClient- how to connect to an external IP address?

与世无争的帅哥 提交于 2019-12-08 11:35:14
问题 I have been trying to setup a basic scenario where a TcpClient connects to a TcpListener on the same machine, but so far it only works for 127.0.0.1 and 192.168.X.Y . Here is my code: var server = new TcpListener(IPAddress.Any, 51328); server.Start(); var client = new TcpClient(); client.ConnectAsync(IPAddress.Parse("address from whatismyip"), 51328); server.AcceptTcpClient(); // hangs indefinitely here Console.ReadKey(); I got my external address from whatismyip but I'm not sure if I'm doing

Run Vb.net Program on Ubuntu Server

北慕城南 提交于 2019-12-08 10:36:14
问题 I have a very small vb.net program that has a message box and submit button! just for demonstration when for example send "Hi" it replies with "how are you" ( again, just for demonstration. If it were such as simple, I'd convert the code to PHP ). I want this program to listen on some port in my Ubuntu server that runs Nginx. and Instead of having an input box and a button It'd just accept incoming strings and send the reply string back to the client. I tried creating the server program then

C# TCP Client Cant get more than 1 message in row

我的未来我决定 提交于 2019-12-08 09:48:33
问题 I have build a app that can connect to my server. Everything is running smoothly, but I have a problem when the server send message to client simultaneously. Such as when the server sends 2 messages in row. The client just receives the first one. Is there possible to get more than one message in row? Here is my part of code for client: TcpClient clientSocket; public string IPS= "###.###.###.###"; public int SocketS = ####; public void ConnectingToServer() { clientSocket= new TcpClient();

Reading from a network stream: packet fragmentation

穿精又带淫゛_ 提交于 2019-12-08 07:37:36
问题 I got a server that is managing two clients through NetworkStream.Read . Application protocol is: ClientMessage [128 Bytes] → Response from Server [128 Bytes] Now at server-side: Is it possible, that MyTcpClient.GetStream().Read() returns only < 128 Bytes, although all messages from client-side are exactly 128 bytes long? I guess that such a client message is short enough to fit into one packet on the tcp/ip layer - but could there be some kind of fragmentation or random although? Is

App hangs for 20 secs on exit after TcpClient BeginConnect

北城余情 提交于 2019-12-08 07:10:38
问题 I have problem with strange behavior of TcpClient.BeginConnect() and TcpClient.EndConnect() methods. I use BeginConnect() to add timeout to Connect() method (see extension method code below). If I get connected I call EndConnect() and every thing is ok, but If I get timeout I can't call EndConnect() because it will block for about 20 seconds, so I just call this non-blocking code: result.AsyncWaitHandle.Close(); result.AsyncWaitHandle.Dispose(); client.Close(); Problem is when I close the

How do I “flush” a TCP Client Buffer?

三世轮回 提交于 2019-12-08 06:02:13
问题 I've pulled from several examples to setup a Full Duplex C# TCP Client connected to a server. The basic concept is that the client and server both send/receive messages (commands and events). Therefore, I've developed a FullDuplexSocket class that exposes a Send method to send messages to the server and a event handler to receive messages from the server. Everything works except I can't seem to flush the buffer of messages received from the server. Each time the server sends a new message,

C# Mutlti-threading file transfer using TCP

跟風遠走 提交于 2019-12-08 05:45:10
问题 I am designing TCP server for receiving the file from client. Its working for one client. But Server need to respond multiple clients. I don't know how receive multiple files from clients at a same time. Please help me. Server Code: public partial class Form1 : Form { Thread t1; int flag = 0; string receivedPath = "yok"; public delegate void MyDelegate(); private string fileName; public Form1() { t1 = new Thread(new ThreadStart(StartListening)); t1.Start(); InitializeComponent(); } public

C# Reading stream from TcpClient

不问归期 提交于 2019-12-08 05:35:46
问题 I'm making a server - client program using TcpClient and server. To send from the server I use: static void send(string data) { sw.WriteLine(data + Environment.NewLine); } And when the client connects I'm sending some text: client = listener.AcceptTcpClient(); sr = new StreamReader(client.GetStream()); sw = new StreamWriter(client.GetStream()); string line; try { send("Hello world"); } //More code And to read from client: string data; data = sr.ReadLine(); if(data != string.Empty || data !=

Sending data over MultiPath TCP

混江龙づ霸主 提交于 2019-12-08 05:33:42
问题 After installing MPTCP on my two debian hosts, I would like to know how can I send data using MultiPath TCP. Thank you 回答1: Make sure you rebooted with the mptcp kernels (sysctl -a|grep mptcp should return a few results) and then contact (via iperf for instance) an mptcp enabled server such as http://multipath-tcp.org. You should then be able to see the number of created TCP subflows via cat /proc/net/mptcp. 来源: https://stackoverflow.com/questions/21701397/sending-data-over-multipath-tcp