Click here to Skip to main content
15,888,271 members
Everything / TCP/IP

TCP/IP

TCP/IP

Great Reads

by Espen Harlinn
A .NET Core client implemented in C# using TcpClient and a multi-threaded server implemented in C++
by pdoxtader
Learn how to view a remote machine's file system using your own explorer like window, and transfer files and folders by dragging and dropping in C# using the TcpComm TCP library
by bkelly13
Goal: Describe how asynchronous or non-blocking TCP code works
by Dan Randolph
Builds on the existing RunRemote project to run commands on a remote server.

Latest Articles

by Patrick Eckler
Example of a TCPIP server that listens and can serve multiple client connections
by Mirzakhmet Syzdykov
Network programming in C++
by Espen Harlinn
A .NET Core client implemented in C# using TcpClient and a multi-threaded server implemented in C++

All Articles

Sort by Updated

TCP/IP 

4 Jan 2011 by #realJSOP
See if your firewall will allow you to specify an application instead of a port number. Most software firewalls should allow this. I think that even my hardware firewall does. Of course, most places have both a hardware firewall appliance in place, as well as software firewalls running, so it...
12 Jun 2011 by #realJSOP
You could add a "command header" to the beginning of your byte array that is comprised of a known length, say 64 or 128 bytes or even larger (to give you room to grow). Then, you just plug in your command/param values into that area. As long as both the sending and receiving apps are aware of...
19 Jul 2019 by #realJSOP
"This idea doesn't seem to work" doesn't tell us ANYTHING. Beyond that, TCP is merely a transoport mechanism and already uses "packets, so there's that... Are you doing sopmething like this to encode images? byte[] imageArray = System.IO.File.ReadAllBytes(@"path/imagefile.ext"); string...
29 Jul 2011 by 01.mandar
i want to send data from a server to a device but device is in different network's subnet (both are able to connect to internet)is it possible for client to connect server which is in subbnetting.Windows OS[10.20.30.40] --> -->> INTERNET -->>--> [13.14.15.16]ROUTER [192.168.1.1] -->...
21 Jul 2011 by 2irfanshaikh
I think this link will help you...Connect to a web service through a Proxy Server[^]
31 Jul 2012 by _Amy
Hi,Refer this[^] for the similar discussion.
9 Mar 2022 by _Asif_
MLLP is Minimal Lower Layer Protocol used in transmitting Health Level Seven (HL7) messages via TCP/IP. And your code does not follow that protocol. If you have had googled, you would have found tons of articles elaborating what MLLP is and how...
15 Jun 2010 by _Damian S_
Several different methods are discussed here[^] however they are all to do with testing websites... assuming this is what you want to do, you could probably find one you like!
11 Feb 2015 by abb4s
hi every body.i pass one day to do it but why it isn't working i don't know .i used Scanner and PrintWriter class to send and get data . i want just create a simple corresponding between a client and a server .in a loop client send a text to server and server answer to him "your message...
10 May 2014 by Abhinav S
Socket.ReciveTimeout[^] could help you achieve this objective.
1 Mar 2012 by Abhineet Ayan Verma
Hi All,Can anyone tell me: "How To Construct A Header?" I am writing a FTP Client-Server Code. And I want to construct a Header for the data packets I have to send to server with information like the size of my data,etc.Any pointers towards sample/example code would be...
7 Mar 2012 by Abhineet Ayan Verma
Hi All,I am writing a code to implement FTP Client-Server which have the methods for 1. Client Username-Password Authentication.2. Downloading A File.3. Uploading A File.Now the steps in which my code should work is:A. Server keeps in memory the Username-Password Pair.B. Each...
5 Jan 2012 by Abhishek Nandgaonkar
heyy guys.. m implementing PEER TO PEER FILE TRANSFER..What protocol should I use? TCP or UDP? And why?
5 Jan 2012 by Abhishek Nandgaonkar
Yes, agreed. But what i want is precisely how easy or difficult is it to implement either of the options.Also, if you have an experience of making an application of similar kind, i can get a better answer.
5 May 2012 by abu7midan
I have class on pc1 that controling parallel port I wanna want to control parallel port over TCP/IP then iwanna I want to use event key_downHow I do that?
5 May 2012 by abu7midan
i was use method output()then the commands with tcp client server not effective solution my question is how i can run method on another pc by keyboard
17 Jan 2011 by ad_robot
Hi Everyone, I'm implementing asynchonous socket programming in (C++, winsock, TCP/IP, based on this example Chat Client Server[^]) at the moment (for data streaming) and am running into problems with missing data when I run the code over a network rather than locally (I only seem to recieve...
22 Dec 2014 by Adam Lee
Hello I am using Xsocket for Duplex communication between server -client . Every thing was working fine . my sample can work on different network but i find out the Main issue in Xsocket.. if Client is behind Router and proxy ,Proxy preventing ICMP traffic Then Xsocket Not...
30 Jun 2012 by Aduu
I am writing an application to send/receive some data to and from a server. I need to make a connection before sending some data and need to keep it open so that user can send data continuously. The user can close the connection at any time by clicking on disconnect button. I created 2 buttons,...
20 Jul 2010 by Aescleal
If you accept the general definition that a server is something that listens for a connection you haven't really got a straight client and server here... Both what you're calling your client and what you're calling the server are actually both clients and servers.So your "server": -...
4 Jan 2011 by Aescleal
To amplify Rod and Emilio's answers a bit, do a search for some combination of "NAT", "port forwarding" and "IP address sharing". Your problem isn't uncommon and there a lot of networking admins that understand this stuff far better than most developers do.Cheers,Ash
13 May 2015 by Afzaal Ahmad Zeeshan
A Windows Forms application would be good, but since you're going to allow multiple users to communicate through the same hub (server), ASP.NET would be better. If you do not want to use a website, with a layout and other formalities, ASP.NET Web API[^] would be best for this type of...
2 Aug 2015 by Afzaal Ahmad Zeeshan
You are confusing yourself with TCP (or UDP which is a connectionless protocol, similar to TCP) and network topology, ring in your case maybe. I would, in this case, suggest that you do not write such a thing. Instead, I would recommend that you create a server for TCP clients and let it...
27 Sep 2017 by Afzaal Ahmad Zeeshan
You are doing that correct, what you need to add here is some sort of a middleware that takes that question and generates an answer for that. Since you have not shared any further information it is very difficult for us to answer. But, that will be something like this, stream.Read(buffer, 0,...
5 Mar 2012 by agent_suwastica
How to connect to smtp server that requires ssl connection ?I am using vb6 winsock control.The server(smtp.gmail.com) is sending a "Must issue STARTTLS first" and when I Send "STARTTLS", the connection was lost.Please help :))
17 May 2012 by Ahmed Charfeddine
A Websocket protocol implementation atop the ush Framework real time library plus a demo example featuring four types of communication workflows between the HTML5 web client and the server.
9 Feb 2014 by ajaytvish
I need to code a server and a client that communicates using tcp and an asynchronous communication. I wish to implement it with only the basic api's like createsocket(), listen(), connect(), bind() etc. CAsyncSocket is available but that's MFC and I am looking for basic help related windows api.....
25 Mar 2011 by al_in_the_city
Hello Everyone,I have written an application that transfers files using FTP. I now need to change this program since some of my clients no longer allow FTP applications and are requesting that I use HTTP/HTTPS instead. Does anyone know of any commercial libraries/SDK that I could use to...
3 Dec 2015 by Albert Holguin
That's actually not that much data, so your OS is probably buffering data and waiting to transmit that at a later time (in case there's more to come).Check your MTU size (likely in the 1500 bytes range) and perhaps try reducing that size to something small (in Linux you can run sudo ifconfig...
12 May 2016 by Albert Holguin
raspivid -t 0 -o - | nc 172.16.26.32 5001 (my windows pc address and the port number)Seems like you're running this as a client...nRet = connect( hServer, (sockaddr*)&saServer, sizeof( sockaddr ) );if( nRet == SOCKET_ERROR ){ cout
7 Nov 2016 by Albert Holguin
Well, if you're not sure, TCP/IP should usually be your default go-to. That's because it has a lot of neat built-in overhead that's very useful, such as retransmissions and error checking, that UDP doesn't have. UDP should be used when you need high-speed transmissions where you don't mind...
9 Jun 2015 by AldoBlack
Hello,I have 6 devices, price checkers. I have a project which the client in a supermarket will scan a product on this device and it will return the price of the product. I have managed to connect with one device, get the bar code and send data. But I can not seem to do to connect with...
14 Aug 2014 by Aldrich Logan
actually i dont know how to explain my problem in english cause im not good at but ill tell what im making ... im making a internet cafe management system where in remotely control the clients send message and monitor their consumed time as well as locking their computer shutdown or restart i...
18 Sep 2013 by alex giulio
I am working with a project be related to Gmail. When I send from a Gmail to others, I want to know whether the recipient of mail (to whom mail was sent) read/opened my email or not. So, how can I write codes? Please, help me! Thank you so much!
8 Dec 2015 by Alexandru Lungu
I don't think that is the problem; (it is hard to assume that the TCP stack implementation is so flawed).If your logic is like this:send asend bsend cand the receiver receives a and c, then it might be.However, I assume that the receiver doesn't receive c, which means that the...
28 Oct 2010 by Alexeirob
Hi,How can I force the windows to perform DNS queries only over TCP?If the DNS reply is truncated then the DNS client will send DNS over TCP, but how can I enforce it from the begining?Do I need to hook something for it? Or just change something in the registry?Thanks.
1 Dec 2010 by Alexeirob
Hi,I'm having a problem with accept function in Windows.It takes 2-4 seconds to accept a socket from another 3rd party application.Here is my code:DWORD dwStart = GetTickCount();AcceptSocket = accept(ListenSocket, NULL, NULL);DWORD dwEnd = GetTickCount();DWORD time = dwEnd -...
2 Dec 2010 by Alexeirob
Conditional accept blocks the accept() for 2-3 seconds even if the connection is ready.I can't remove the conditional accept (3rd party application) and I'm sure that the connection is ready.What can be a solution to that?Thanks in advance.AR
11 Jan 2012 by all names are already registered so noname
Hi there,I have developed tcp server and client for Trader to view live rates of Indian market. (somewhat like http://www.interactivebrokers.com/en/p.php?f=tws)My application sends Live tick data of each and every stocks to client but some of user want to get data of specific 4-5 stocks...
22 Oct 2018 by alobiedy
i am trying to read data from RFID reader using C# or VB.net my PC as server with ip 192.168.1.12 Port 9999 reader IP 192.168.1.99 https://preview.ibb.co/hi3gvf/555.jpg What I have tried: tcpLsn= new TcpListener(8002); tcpLsn.Start(); Thread tcpThd = new Thread(new...
2 May 2013 by AlphaDeltaTheta
Well, your code is absolutely correct there is no issues with it.You are encountering a bind exception. Such exceptions occur if the underlying operating system is unable to create an socket at the specified port. It might be for the following reasons:1. The port 53 is already in use. In...
2 May 2013 by AlphaDeltaTheta
Well, your has no issues with it. Except for the thing that the constructor used to create a datagram socket for receiving must not include the ip address. It should be like thisDatagramPacket p = new DatagramPacket(buffer, buffer.length);You are encountering a bind exception. Such...
28 Dec 2010 by Aman4.net
Dear cyberm0t0,I would like to tell that while you are using database in your project you need to write ConnectionString in your code to establish connection. No other settings are required.Best place to write ConnectionString is Web.config (in Web Project) and App.config (in window...
23 Jan 2017 by Ameer Dhotre
how to do one to one chat using asp.net c#? ,without signalR.or using console app using c#.kindly help me, I am new at network programing.What I have tried:tried client server chat ,in console and windows.
25 Dec 2011 by amertarekt
I have a machine that is a handheld.with this machine i can connect to TCP LAN and send and receive data to/from server i have a function TCP_configuration() //configure the local ip , local port , subnetmask ...TCP_server_configuration() //configure the server ip and server...
8 Jan 2012 by amertarekt
Anyone know that we can call web service in C# using Add Web Reference in VS2008 and we can call it through c and c++ using SOAP library like gsoap librarythis library convert the xml string that is used to call the webservice and send it to it through a port is anyone know how can i do...
9 Jan 2012 by amertarekt
I solved it We can Call webservice using Tcp/Ip by sending the XML Code that is appearing under the page of function calling in the webservice page like thiehttp://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry[^]to port 80 and the server and wait for the HTTP responce
27 Jan 2014 by Ami_Modi
I got another way out to get open statistics in following link: http://www.aspnetemail.com/samples/emailtracker/default.aspxThis is the easiest way.
26 Jul 2012 by Amir Hesami
A library which can get any class you pass to it, convert it to bytes, and send it to the other end.
11 Jan 2011 by amir tarek
I have some problems in my web service .As we all know, the web service is just a service on a database that I ask for using some interface and it returns the answer to me.I want to make a webservice on the database that has a function that runs forever.This function checks for input on...
3 Oct 2012 by amir tarek
this is my code #include "tcpclient.h"#include#include #includeusing namespace std;tcpclient::tcpclient(QObject* parent): QObject(parent){ connect(&client, SIGNAL(connected()),this, SLOT(startTransfer()));}tcpclient::~tcpclient(){...
18 Dec 2012 by amir tarek
i will explain my problem and please try to help me i want to access a web-service from Point-Of-Cell Handheld its SDK use C language on eclipse at first i wanted to learn how to access web-services from C or c++ LANGUAGE and i succeeded in this using gsoap library and i can...
15 Oct 2015 by amir.nazarizadeh
HiI have a simple chat program in c# with a client and a serverwhen I start the program it give me warning with this message:Additional information: Could not connect to net.tcp://localhost:1234/Chat/ChatService. The connection attempt lasted for a time span of 00:00:02.0986369. TCP...
21 Aug 2018 by Amol Sagvekar
I have asp.net application which executes 3rd party link/URL internally. And that 3rd Party server accepts only one IP address so if I added my machine IP to that 3rd party server then its work but if I access that application from another machine then it is not working. I have 100 users and...
21 Aug 2018 by Amol Sagvekar
I used proxy concept to fix this issue and its working.
3 May 2021 by Amruta.87
I have created the TCP socket server in node js. I want to send the received data packets to the webpage. My TCP server code is as follows I want to read some data packets and display it on the webpage. Data Packets example as follows: ...
20 Mar 2012 by Andre Trollip
Hi Guys,I'm at my wits end.I have a self hosting (console app) WCF service using Net.Tcp binding with all default settings.Inside one of the service methods, I use a UdpClient to send a udp packet to another unrelated IP/Port.When the method returns, I get that boilerplate...
6 Jul 2013 by Andrew Augustino
Hey guys,This might be a common problem to MS SQL Server users but my problem is a bit different from many of the similar problem explained on many forums.I have SQL server database located on remote server, whenever I tried to access the database by using LAN(other computer on the same...
17 Jan 2011 by Andrew Brock
A few pointers that you may or may not already know:Remote debugging can be set up by running msvsmon.exe from C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\\msvsmon.exe on the remote computer or VM. This is in the 64-bit Program Files on a 64-bit...
1 Aug 2017 by Andy Galluzzi
NAT traversal for Software Developers
3 Nov 2017 by Andy Lanng
Hey, I have written a bespoke "latency checker". There is a client and server. Client is Console App and service is a Service. I am restricted to .Net 3.5. So this all works locally fine, but on the clients main server it throws an error:while (!client.Connected && retry-- > 0) Null ref...
3 Aug 2010 by ankitpsaraogi
This is the form.cs in my REMOTE SERVERusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.Remoting;using System.Runtime.Remoting.Channels;using...
4 Aug 2010 by ankitpsaraogi
Yes I have even tried turning off the firewall...Are my codes correct???
25 Mar 2011 by ankitpsaraogi
Please check my Program and help me.Its running succesfully in the local machine but not working over LAN or Internethttp://www.4shared.com/file/mYSD5KDg/RemoteApp.html[^]CODE:Remote Class:::xx.cs file:using System;using System.Collections.Generic;using...
4 Nov 2010 by Anthony Mushrow
I believe that even if you have enough bandwidth to cope with the amount of data you want to send, there's too much overhead and latency with sending that many packets. When sending over TCP you need to send the packet which will have a small delay as it gets sent onto the actual network...
26 Dec 2011 by Anuja Pawar Indore
Read this thread, might help youhttp://stackoverflow.com/questions/7699794/how-to-read-multiple-tcpports-at-same-time[^]
5 Feb 2011 by Anupama Roy
I think you need to convert the data to be send/receive as byte array.That's how it works when you send/receive data over the network.The below article clearly explains this.Take a look.TCP/IP Chat Application Using C#[^]
20 Jun 2013 by Archit Patel
Why isn't it sensible to dedicate more than one TCP/IP port to http? Although admittedly naive, isn't it somehow intuitive to think that server performance could somehow be increased?
21 Apr 2021 by Arda Güler
Hi, I recenlty started working on a streaming app (c#). I made the general design but I'm still unceartin of the protocol I will use. I read that UDP is the most preffered choice for video streaming (because of speed I guess). and I've watched...
30 Sep 2010 by ARopo
Depends on your deploymentEverything on the same machineEverthing on a LANEverthing over a WANOver the internetFastest would be tcpip, but this would present firewall problems if over a WAN. Regarding crashing on high load that would depend on how well your software and...
6 Sep 2013 by arunrv
Hello Every , My project requirement is need to communicate between server and client .Presently I can communicate from client to server ,means when client request for service server response to request but I want the same response where server request for service client...
29 Mar 2012 by Arvindabc
How to send enable password using expect i have written my code but having some issues in it .proc clearLine { conServerIp} { set password "lab" set enablepw "lab" set spwnid [ spawn telnet $conServerIp] expect { "Password:" { ...
26 Mar 2014 by asadali.awan
Is there any soft ware that allow me to have server and the client on the same machine , and then sending data between each other , PLease answer urgently
16 Jan 2011 by Ashish Tyagi 40
First of all check whether your app is connected to internet using this link.. can you see me[^] put your listing port no and hit check button..If it failed probably you are listnig on 127.0.0.1(localhost) or your LAN address (like 192.168.0.10)so change your listing interface address to...
30 May 2013 by ayesha hassan
I have developed a single server/multiple client TCP Application.The client consists of x number of threads each thread doing processing on its own data and then sending the data over TCP socket to the Server for displaying.The Server is basically a GUI having a window. Server receves...
17 Dec 2014 by B. Clay Shannon
I'm trying to be the "enabler" of a TCP conversation between a handheld device and server app running on a PC by adding code to the handheld (C#, WindowsCE, CompactFramework). I ad[a,o]pted an example I found online to this: TcpClient client = new TcpClient("PPP_PEER",...
6 Mar 2018 by Babai JermenKeller Sasmal
Good morning to all codeproject expert. I need some help down here to access controls value (Textbox, DatagridView) of server_side application from client_side application over TCP. How can I do this ? Looking for some ideas and maybe code or links that lead me to this. Well My server is...
17 Dec 2014 by BacchusBeale
The function sr.ReadLine(); is waiting for a new line e.g usually via command line.To read the response you need to get the Stream and read the bytes into a buffer until it's empty.
14 Apr 2012 by bagus bujangga
Hallo there.any body know how to send data (image.jpg) from wp7 to server (PC Server)?I tray to manipulated image like Cropping,Biner,and many convolution and after all this proses i want to upload/send image to my PC Server (to my TCP/IP in computer server)I don't have any experience wp7...
11 Jan 2011 by Baji Jabbar
From the question what I understood is you need a Windows service to check the value in the TCP/IP port. Web service need to be invoked always.If you want the Web service to do the checking use the windows service to invoke the web service , which ( Web Service) in turn do the checking and...
25 Oct 2012 by barneyman
I think you may want to look at the UPNP Protocol[^]That's the accepted way of devices/PCs on a private LAN negotiating dynamic port forwarding with the routerThat's how the Xbox and BitTorrent clients (for example) can all accept incoming connections without you setting anything up on...
19 Apr 2015 by barneyman
the most obvious problem is you ignore the size of the chunk your read (read_size) and always write buffersize bytes to the file
10 Aug 2023 by Bartholomeus van Tuÿl
I have been building a VB.NET application which works by sharing out data between a TCP client and TCP server. The data being shared are small XML, CSV and PNG files. I have limited knowledge on TCP projects and thought it be a feasible idea to...
22 Nov 2013 by Baxter P
25 Oct 2012 by bEGI23
I researched on Google about what the use of Port-Forwarding is. I came to know that the Job of the Port Forwarder is to set a Connection between the Start Computer and End-Computer, which is one of dozens of Local Computers on that Router. For that we must specify on the Router Options, under...
5 Aug 2013 by bhram12
hello , looked a lot for source code to capture and monitoring communications processes like this tools : TCPViewerhttp://i.imgur.com/ztmFYKI.png[^]it's show name process and ip , port i found this project but it's C# and I do not understand codes...
2 Oct 2012 by bigbro_1985
Hi,I have a slight problem with my code where my entire program halts while sending/receiving TCP/IP messages. I also noticed that it affects another application that is connected to the same IP address but on a different port. Am I handling something wrong here? I'm assuming the fact...
14 Sep 2018 by bkelly13
Goal: Describe how asynchronous or non-blocking TCP code works
7 Aug 2014 by bling
You can use pthreads on most platforms.http://www.cs.nmsu.edu/~jcook/Tools/pthreads/pthreads.html[^]On Windows, you can use beginthread() or beginthreadex().http://msdn.microsoft.com/en-us/library/kdzttdcb.aspx[^]As an alternative to creating threads, you can set the accepted...
8 Aug 2014 by bling
Drop the call to join(). There's no need for it.Also, change the run() function:void* HandleResponse::run() // when call start it call this function thread{ int size = 0; do { size = read(Socket, bbuf, sizeof bbuf); write(Socket, bbuf, size); ...
22 Aug 2015 by blitzkrieg89
I have created a chat application using TcpClient and TcpListener in Visual Studio.All works fine when I run the server on my computer.I want to host the server application online on the Internet, like GoDaddy.com, so that it can be accessed from anywhere.Is this possible? If not, any...
5 Oct 2011 by BobJanova
To establish a connection:- the address you are trying to connect to must be visible. Is it correct? (If another port on the same address works, this is probably not the issue.)- a server must be running on the port you specify. Did you start a server that listens on the port you are trying...
24 Oct 2011 by BobJanova
Obvious question: do you ever close the connection at the other end?NetworkStream.Read will return 0 if and only if the connection has been terminated (otherwise it will block until there is at least one byte). So check for that in your loop condition. Read will also never read more than the...
25 Oct 2011 by BobJanova
NetworkStreams don't guarantee that one send = one receive. So you either need to add a delimiter which marks the end of a message, and buffer results until you reach it (ReadLine is doing this for you automatically), or you need to send a message header which includes the message length before...
25 Nov 2011 by BobJanova
TCP guarantees that data will be received in order if it is received at all, and automatically error-checks and resubmits if there are packet loss or corruption issues. For normal applications you don't need to do anything else.The one thing it doesn't do is make one send match one receive...
9 Jan 2012 by BobJanova
This is almost certainly the wrong approach. Port numbers are a precious resource and if you have control over the protocol, it is much better to only listen on one, well known port and have the first message in the protocol be a switching message that chooses further details of future messages...
21 Apr 2013 by bshokati
How to create a client-server network for multiplayer game programming using C++ and Windows Winsock
5 Nov 2012 by CafedeJamaica
You can set up a TCPListener depending, if you google the class there is a very straght forwad example.http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx[^]make sure that you select the right version of .net for your client implmentation for the example.
8 May 2011 by canard29
HI all,How to develop in C# a program to communicate (send and receive) with this existing C++ library ??This library is already developed and I can't change it.I tried putty with this parameters with success :http://athiri.cimds.ri.cmu.edu/files/TcpBridge-putty.jpgThink you...