Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [tcp]

Transmission Control Protocol (TCP) is a transport layer protocol that provides a connection-oriented data stream service with guaranteed, in-order delivery.

Filter by
Sorted by
Tagged with
23 votes
2 answers
14k views

Simple and effective port checker in C++

Intro A couple of weeks ago I finished a Python implementation of a multithreaded port checker and I wasn't quite happy with the result I've got (speed). I needed it to be faster, so I've built ...
Grajdeanu Alex's user avatar
20 votes
3 answers
3k views

Simple webserver in C

My first learning project in C. Looking for general feedback e.g. gotchas, coding standards, formatting, naming etc. I'm here to learn! webserver.h ...
brasimon's user avatar
  • 301
18 votes
1 answer
4k views

TCP Socket Wrapper

I'm trying to build a simple server software for training purpose, most likely a IRC server, but I'm not there yet. I'm currently implementing a TCP socket class, to ease the use of the C socket API. ...
florian-s's user avatar
  • 183
15 votes
5 answers
987 views

Raw Text TCP Client

Yesterday I posted a request for a code review. After reviewing the code and the reviews, and after some sleep, I decided I can do better. In fact I logged on with the intent of deleting the question ...
motoku's user avatar
  • 2,521
15 votes
1 answer
9k views

Event Based TCP Library

A while ago, I wanted to make a multiplayer game, so I wrote some TCPClient and TCPListener code, and it worked, but it was ...
Noah Heber's user avatar
14 votes
1 answer
19k views

Asynchronous TCP server

After some investigation, I implemented an asynchronous TCP server as per the following example. During my investigation I was unable to find an example that cleanly shuts down the server; after some ...
RiaanDP's user avatar
  • 243
13 votes
3 answers
10k views

C# TCP server/client class

Goal My goal is to create a TCP server/client class that can be universally reused in various private projects. It should work stable and does not need to be super fast, but rather light-weight to ...
dadul96's user avatar
  • 153
13 votes
4 answers
29k views

TCP Socket Server

I've only been coding C# a few weeks and was just hoping for a little constructive criticism of a socket server I've been working on: ...
Ben Gale's user avatar
  • 233
13 votes
3 answers
3k views

Correctly applying the "rule of five" to a RAII socket wrapper

I was trying to create a simple RAII wrapper with rule of 5 for a TCP POSIX socket. My aim was to try learn how to apply rule of five in different situations, but this one was somehow tricky. ...
Afshin's user avatar
  • 295
13 votes
0 answers
3k views

Socket application using TPL

This is an application I wrote that allows multiple TCP clients to share a single TCP connection to a remote server (hosted project, and a demo). Traffic generated by the server is forwarded to all ...
KFL's user avatar
  • 231
12 votes
4 answers
6k views

TCP client reconnection logic running on 30 machines

I am working on a service that is supposed to run on a large installation 24/7. Once the software is deployed, I will most likely not be able to make any changes anymore. This is my first time working ...
DoughySpoons's user avatar
12 votes
3 answers
25k views

AsyncTcpClient (Asynchronous TcpClient)

I've been doing network programming using C#'s TcpClient for several years. The code below is an asynchronous wrapper for ...
Gigi's user avatar
  • 261
11 votes
2 answers
254 views

Raw Text TCP Client v3

After studying and considering the reviews for this code, I began working on the code, and came up with this. It has much better error and disconnect detection, and it also resolves addresses: ...
motoku's user avatar
  • 2,521
11 votes
2 answers
16k views

Console chat server

I'm just looking for feedback on correctness of my understanding of async/await. I'm curious about the Task.Run inside of the ...
jeremywho's user avatar
  • 253
10 votes
2 answers
18k views

Send messages in TCP-based communication system

I am working on a TCP-based Communication System. I wrote a working function for sending Textmessages and remotely opening a MessageBox. I would like to know how ...
user150415's user avatar
10 votes
1 answer
4k views

Network protocol using TCP, sending images through sockets

I would like to ask about your opinion about my code. The idea is simple: I designed my own protocol, where client asks the server about the image, and the server sends the image, following the below ...
yak's user avatar
  • 223
9 votes
1 answer
25k views

Stupidly simple TCP client/server

I'm trying to validate some results that I see when using NetPipe to test some connectivity between a couple of Linux boxes (over various hardware). So, I concocted this simple client and server to do ...
Nim's user avatar
  • 460
9 votes
1 answer
6k views

Simple C Port Scanner

I have been writing a Simple Port scanner in C, once I got it to work I decided I wanted to make it faster because it takes a very long time for it to get done with scanning all of the ports.Is there ...
user3000477's user avatar
8 votes
2 answers
41k views

C++ Linux TCP client/server socket wrapper

I am relatively new to socket programming, so I would like to ask if there is anything wrong with my code :) For the server socket I included the great new C++ lambdas, so you can start an ...
dvs23's user avatar
  • 83
8 votes
3 answers
10k views

TCP Chat (Server/Client)

I'm looking for some hints or advice regarding efficiency, performance and some good coding practices. Also I'm curious about synchronization. The server is multithreaded, so I think some operations ...
Daniil Molchanov's user avatar
8 votes
1 answer
2k views

TCP client and server API

I made a server and client API for TCP connection. It is intended to shorten the work you need to do to prepare the server and client. It's separated into 3 projects - ...
Denis's user avatar
  • 8,478
8 votes
1 answer
448 views

Latency problem for keyboard remoting from Android phone

I'm writing a simple remote PC app (mouse-keyboard). Android is client and is connect with WiFi to Java PC Server. I'm using TCP but I see a bit of latency compared to other remote apps. Then I used ...
user avatar
8 votes
1 answer
3k views

Python Socket Receiver

I put this together and am having some doubts to the number of connections I can make. I also doubt if I can brute force the server to serve up connections and then hang. Please take a look and tell ...
kg_root's user avatar
  • 81
8 votes
1 answer
4k views

Custom TCP Java proxy socket load balancer

I'm working on implementing a custom TCP proxy server which acts like a load balancer. The proxy server will accept client requests and then forward them to available hosts. I am concerned about the ...
Sam Hams's user avatar
  • 181
7 votes
2 answers
2k views

TCP Tunnel in C

I'm completely aware that I'm not using NIO, but this is my first polished C project. All criticism is welcome, if I'm doing something wrong, I want to nip it in the bud before I'm used to it. ...
JavaProphet's user avatar
7 votes
2 answers
8k views

TCP socket retry mechanism

I am writing a C++ client application which will send some data to server and wait for its response. Now the protocol is to wait for a specific timeout and then retry for specific times. If all goes ...
hypheni's user avatar
  • 191
7 votes
1 answer
11k views

Performant C# Socket server

I am creating a performant C# socket server. I'd like it to be able to accept as many simultaneous connections as possible. I've tested with 100 clients and all clients are fine. With 1000 however, ...
Sam Leach's user avatar
  • 295
7 votes
1 answer
5k views

Async TCP client/server

I'm working on a simple async TCP client server application, i'd like my network code to be reviewed. I really feel that I'm doing something wrong, especially in receiving code. Interface for client: ...
HardLuck's user avatar
  • 175
7 votes
1 answer
5k views

Non-blocking TCP and UDP in Unity3D Game Engine

I would like constructive criticism of a networking plugin I've written for Unity 3D. The use-case of the code is for people in "creative coding," where simple TCP and UDP messages are used for ...
Yosemite's user avatar
  • 137
7 votes
1 answer
15k views

TCP authentication server and client

This is the first time I'm dealing with C# as I'm accustomed to Java sockets, so I do want your full review and anything you think I can accomplish better or optimize in the code will be very ...
Daniel Netzer's user avatar
7 votes
1 answer
2k views

TCP Server using NIO to save data from IoT clients

I've built a small single threaded TCP server using NIO. This server is used by small client devices to report things like temperature, when the device has been switched on, when it switches off, and ...
mal's user avatar
  • 313
7 votes
2 answers
12k views

Protocol implementation, TCP, sending images through sockets - follow-up

I would like to ask about your opinion about my code. The idea is simple: I designed my own protocol, where client asks server about the image, and the server sends the image, following the below ...
yak's user avatar
  • 223
7 votes
1 answer
228 views

TCPListener server to discover clients on a network

I am currently writing a program to sync files (music, photos, etc) from my PC to an Android device. In order to do this, I have 2 application: one that is running on my PC, and one that shall be ...
Choub890's user avatar
  • 173
6 votes
2 answers
3k views

Java NIO Server Scaling

I wrote a Java NIO Echo Server and want to maximize the number of connections to the server. The problem is that when I try to connect more than 10k clients the clients get their connections refused: ...
cruxion effux's user avatar
6 votes
3 answers
5k views

My first implementation of a client/server application

Well, it's 2 applications really. Each one does its own stuff on the front-end. It's the networking that I'm most concerned about. The Server starts listening for connections on the specified port as ...
Ortund's user avatar
  • 531
6 votes
2 answers
2k views

Scanning for open ports

I made what started out as a web browser but now is a scanner for open ports. I wanted to know if you think this is a realistic or a unreliable tool for port testing. I found some open ports on my ...
Edward Severinsen's user avatar
6 votes
1 answer
17k views

WPF async await TcpClient/TcpListener sample

I want to build a robust and highly scalable client server system. Here what I have so far(an echo server as my base of implementation) My Server ...
Syaiful Nizam Yahya's user avatar
6 votes
1 answer
566 views

Read HTTP header from TCP socket

I'm growing a web server in Haskell that interfaces with TCP sockets using network. To read the HTTP header of the client's message, I use the following function: ...
Matthias Braun's user avatar
6 votes
1 answer
43k views

Creating a TCP Listener and receiving data

I am very new to network programming and I'm thinking I have probably misconstrued the creation of an appropriate TCP listener. The code I have below works perfectly, but I have a feeling it's a "hack ...
Volearix's user avatar
  • 829
6 votes
1 answer
595 views

Server-client data transfer

I coded a server-client (kind of) chat, and I need your review as I'm sure it is a mess. I used lots of tutorials and tips form different websites and forums which were posted at different times (...
Cosinus's user avatar
  • 61
6 votes
3 answers
3k views

TCP socket server for UNIX

I'm very new to C++, but I really want to write good code and increase my development skill, so I ask you for some review. Scheme of socket server This is the scheme of how my socket server works. ...
Kolyunya's user avatar
  • 217
6 votes
1 answer
7k views

TCP Client-Server communications

I have developed this simple TCP Server/Client communication program, and am looking for ways of lowering the code footprint where possible.Side note, Both Classes are Main as they run independently, ...
BenignReaver's user avatar
6 votes
0 answers
2k views

Implementing a TCP client in Golang

I am very new to concurrent programming in general and want to know if my implementation is thread-safe. I'm currently working on implementing a TCP client in golang. The service listens on a port ...
Jayaram's user avatar
  • 213
6 votes
2 answers
3k views

Socket chat room in Python

This is a Python chat room that I've been working on and it enables to you to chat to other people on the same network through Python. Server.py: ...
colkat406's user avatar
  • 482
5 votes
6 answers
811 views

TCP communication with step motor

I have a class that I use to communicate with some hardware equipment (a step motor to be precise): ...
Yoav's user avatar
  • 319
5 votes
3 answers
140 views

Fetching filesystem directory listings on a server

I developed a server which takes a directory name then lists files in it and sends this list to a client. And I want that server to work with Telnet. It works but I have some questions on how I can ...
Nikolay Bildeyko's user avatar
5 votes
2 answers
1k views

Send and Receive more than 64KB over TCP/IP socket

I have written TCP server client code to send data of any size (1 byte - 64KB) in a loop. The client (A) sends data to the server (B). B then sends the same data back to A. A matches the sent data to ...
ASid13's user avatar
  • 85
5 votes
2 answers
8k views

Sending data through a TCP stream

I've noticed that there are several ways of sending data through a TCP stream. I want to do it the fastest way in terms of latency. One method I became aware of is with a binary writer: ...
Zerowalker's user avatar
5 votes
3 answers
388 views

Latency problem for keyboard remoting from Android phone - follow up

I'm writing a simple remote PC app (mouse-keyboard). Android is the client and is connected with WiFi to Java PC Server. I'm using TCP but I see a bit of latency compared to other remote apps. I'm ...
user avatar
5 votes
1 answer
20k views

Simple TCP Send Receive with multithreading c#

Wondering how this sample program can be made better. Specifically what exceptions should I expect to handle? Right now it's working as expected. I put a breakpoint after the statement: ...
Nathvi's user avatar
  • 188