Questions tagged [socket]
For code which uses the Berkley Sockets API (specified by POSIX, and available on Windows too) to communicate with other processes using a network protocol.
327 questions
11
votes
4
answers
1k
views
A simple server-client application in C
I am reading "The Linux Programming Interface" by Michael Kerrisk. I'm studying about sockets, and I made a simple application using sockets on the unix domain.
I want to know if I'm using ...
10
votes
2
answers
1k
views
Multithreaded UDP server that advertises itself in a PostgreSQL database and launches other servers in response to messages from a client
Description
For fun, and to learn some C++, I've decided to reimplement the entirety of EVE online as I remember it. (I'm aware this is an insane and likely unreachable goal, that's intentional).
I'...
2
votes
1
answer
103
views
Optimizing C System Design for Sensor Data Handling
I am developing a system in C for a device running Yocto Linux (Posix compatible, libc, etc.) on a microprocessor. The Yocto build is "quite generalized", as it's supposed to run several ...
8
votes
2
answers
1k
views
A TCP server which uses one thread to read while writing data with another thread
The TCP server in the code snippet below is designed to:
Read data using one thread while writing data with another thread.
Allow only one client to be connected at a time.
Automatically close the ...
7
votes
3
answers
2k
views
Simple TCP port scanner
I’ve done port scanner program. It works well and accurate, but there is a problem.
It’s SUPER slow. That’s how it looks:
...
4
votes
1
answer
152
views
Writing a HTTP server in C
Code
...
8
votes
3
answers
736
views
Send arbitrary number of arbitrary length buffers in packets of fixed arbitrary size
Background:
I am in earlier stages of implementing a standard on top of an existing 'backend'
This standard requires that I send data in UDP packets of a size specified at runtime
All packets must be ...
0
votes
1
answer
159
views
Handling multiple socket communication in Python Client-Server application [closed]
I'm developing a client-server game application in Python. Here's the scenario:
Clients connect to the server and register.
After registration, all clients see a main menu.
One client can initiate a ...
1
vote
2
answers
1k
views
Multi-Client Socket Communication with Thread Pool in C++
I've been working on implementing a multi-client socket communication system with a thread pool in C++. The system comprises three main components: logger.h, socket.h, and thread.h, which handle ...
3
votes
0
answers
223
views
Simple Network Time Server in C++ with improvements from prior code analysis
From code review: OO simple network time server with changes from a previous code inspection and added Windows support
I made many changes as per the review comments. The code has been significantly ...
3
votes
1
answer
156
views
Winsock code for lockstep RTS game
Summary
This is my core networking code for the lockstep RTS game that I am creating. Clients connect to a relay server via a TCP socket, and any packets sent to the relay server are forwarded to all ...
5
votes
1
answer
517
views
OO simple network time server with changes from a previous code inspection and added Windows support
I put up my SNTP Server code for review here:
SNTPv4 server based on rfc 4330 in C++
a fortnight ago and since then I have made changes as per code review comments and also added support for Windows, ...
6
votes
1
answer
220
views
SNTPv4 server based on rfc 4330 in C++
Please review my SNTPv4 server based on rfc 4330
I tested running 3 instances of ntp-check.exe from Galleon systems and 1 instance of Microsoft w32tm - w32tm /stripchart /computer:
No crash!
This is a ...
10
votes
5
answers
971
views
Follow Up: struct sockaddr storage initialization by network format-string
This is a follow up to: struct sockaddr_storage initialization by network format string
First of all thanks to @Haris, @Toby Speight, @G. Sliepen and @chux - Reinstate for their help. I learned a lot ...
8
votes
3
answers
1k
views
struct sockaddr_storage initialization by network format string
I am writing a wrapper library for network functionality in C and wanted to let the user let the user initialize a struct sockaddr_storage with a format string.
Format ist like: "proto:host:port/...
4
votes
1
answer
304
views
A deamon for sending poem to clients based on KISS
My code is about sending random poem from /etc/poem.conf to client using TCP sockets.
In this implementation my daemon have restart mechanism using SIGHUP signal and DEBUG mechanism using defining ...
2
votes
1
answer
529
views
Sending and receiving files in C win32 using a socket
I have a piece of code to send and receive files on Windows with C. Is this the right way to do it? And am I guaranteed that the full file will be sent and received?
Receiving function:
...
2
votes
1
answer
338
views
The receive function for telnet client
This is a follow up question to Send and receive functions for telnet client.
I am designing a simple wrapper around the telnet client using libtelnet for text-based communication to a telnet server. ...
5
votes
1
answer
2k
views
Send and receive functions for telnet client
I am using libtelnet to design a telnet client by sending text commands to a telnet server and receiving text responses. I am utilizing telnet-client.c. For simplicity, I made send and receive ...
2
votes
1
answer
215
views
Priority Job/Task Queue for Linux (sockets and multithreading)
Preface
Please review my implementation of a job queue for linux/unix systems. This is my first time coding in C, although I have quite some experience in C++.
I know this is a moderate amount of loc, ...
6
votes
1
answer
2k
views
Proper way to send and receive buffer in Winsock
I have a piece of code to send and receive buffers. Is this the right way to do it? And am I guaranteed that the full buffer will be sent and received?
receiving function:
...
1
vote
0
answers
511
views
Asynchronous socket server implementation from raw sockets
I've rewritten my HTTP server several times over the past year, because I tend to encounter an issue midway through an implementation realizing I didn't abstract, decompose, or decouple certain ...
2
votes
2
answers
1k
views
Programming Challenge: Python 3 DNS query resolver using socket
This is a DNS query resolver written in Python 3 using socket, I wrote it entirely by myself, it supports 8 primary DNS query types: A, NS, CNAME, SOA, PTR, MX, TXT,...
1
vote
1
answer
71
views
Python Socket Class transfer functions for any networking related program
This code is meant to send an object (any object) over a connection to a recieving program. I want to make sure that i haven't made any red flags. It seems to work fine, i've sent tuples with data (...
2
votes
1
answer
622
views
Resilient & Stable TCP Server Polling
I am looking for feedback to perfect my code developed for WPF in terms of speed, stability and resiliency. My code is supposed to handle synchronous status polling as well as asynchronous Commands to ...
1
vote
1
answer
185
views
simple code that tries to establish tcp handshake. Creating tun device | what ever ip packets message comes try sending valid response.checksum&TCP
So I am getting packets from TUN interface and after that processing the packet, and then try to send correct TCP handshake response message.
It does handle sequence and ack sequence handling but That ...
2
votes
0
answers
186
views
Asynchronous TCP server refactor design & not working features
I'm working on an asynchronous TCP server which is supposed to be used for a chat. I want to get a review for the TCP server part because I'm struggling to find a good design to fulfill the following ...
2
votes
0
answers
1k
views
A reuseable reconnecting TCP socket with Asio
I'm using (non-boost) Asio 1.18.1 and C++17. Forgive the boost tag, there wasn't a more specific one.
I have a async_connect_with_retry composed asynchronous ...
3
votes
1
answer
250
views
Learning Sockets in C# (.Net Framework), Suggested Improvements?
I'm just learning how to allow interconnected apps via Sockets, watched a tutorial last night and based on that this is what I've gotten:
Server.cs
Code:
...
2
votes
1
answer
255
views
Time-Sensitive Synchronized Transfer of Data Buffer in C# to Multiple Clients
This is a C# program that is a reference implementation, it will be used to make a C version after it is stable and bug free. The programs are supposed to simulate sensor data collection and ...
2
votes
2
answers
170
views
Low level tcp socket
Since I am a Unix newbie, I wanted to know if the code reflects the "unix" style and if there is something to add for it to be robust.
P. S. I hope I am not overusing ...
3
votes
1
answer
4k
views
JSON packet transmitter
I'm not familiar with how data transmission works, but I gave my best shot trying to code a server and client-side JSON packet transmitter via Python. Essentially client.py generates random JSON ...
2
votes
1
answer
269
views
FizzBuzz JSON via Unix socket (Go)
At heart, this program is just the basic "FizzBuzz" program. However, the program was pushed further, by making it a client-server via Unix Socket:
Server run, and listening on a socket.
...
1
vote
2
answers
134
views
Simple server to host simple website page with css
I have created a simple server that host html that has css. Please make sure if ur testing then change the paths relative to ur system in listhell.c in respond_main(..) function.
The html file has to ...
1
vote
1
answer
381
views
Server hosting single page site using TCP sockets in C
I have written a simple server to host my page and CSS (CSS file is 22KB).
Using sockets and TCP. Can any one please review it and give feedback on how can I make my server reliable using TCP and ...
3
votes
1
answer
143
views
TCP chat room in Python3
(Previous question)
I've created a server file, that keeps waiting for clients. When someone connects to the server, he can send messages to the server, and from the server it is broadcasted to all ...
4
votes
1
answer
755
views
TCP chat room in Python 3
I've created a server file, that keeps waiting for clients. When someone connects to the server, he can send messages to the server, and from the server it is broadcasted to all clients.
Can you ...
3
votes
1
answer
192
views
Pomodoro timer daemon in C for BSD systems
I wrote a Pomodoro timer daemon for BSD systems in C (may work on Linux with -lbsd).
The server uses poll(2) and sockets to communicate with the client and to ...
2
votes
2
answers
550
views
Write deduplicated 9-digit numbers from concurrent clients to a log
Problem Statement:
Write a server (“Application”) in Java that opens a socket and restricts input to at most 5 concurrent clients. Clients will connect to the Application and write any number of 9 ...
1
vote
1
answer
114
views
Utilizing idle socket server to do meaningful thing (timeout after sleep on epoll_wait)
I write an app server that uses TCP socket on Linux. When there is no traffic (no data is sent by client, no client connect() or ...
1
vote
1
answer
354
views
Java UDP port knocking authentication. Many clients at the same time
This is a student project of mine. I got 4/5 points but I suspect there's a lot of weird stuff in there. I never had a chance to hear my teacher's feedback about it and it bothers me so I figured ...
4
votes
2
answers
2k
views
C++ TcpServer class
I have a class Tcp_Server that implements a TCP server. This is the base class for the other types of servers available in my program. For example ...
5
votes
1
answer
5k
views
Secure socket programming with OpenSSL and C
Background
Lately, I found OpenSSL to be difficult to learn as a beginner, while it can be implemented inside beginner-friendly projects like socket programming. ...
3
votes
1
answer
838
views
How can I speed up the processing of the received channel socket
This currently runs with 1400+ sockets and manages data correctly and in the manner the application requires. I do have an issue with the HandleData method where ...
1
vote
1
answer
97
views
Implementing classes in Javascript
I'm building a simple chatApp. The UI has just 3 interaction areas: input, submit and previous messages button.
But I'm not interested in reviewing the app architecture as much as the javascript ideas ...
4
votes
0
answers
311
views
Simple chat server in Python
I'm new to both Python and socket programming and figured setting up a simple chat server would be good practice. In addition to general critiques of the code, I have specific questions:
What are the ...
1
vote
1
answer
1k
views
Feedback on send/recv functions for non blocking sockets in client side HTTP library
I'm working with TCP sockets in C, specifically only for client side HTTP(S) requests, and would like to get some feedback on my send and recv code.
You can make some assumptions regarding my code, as ...
2
votes
1
answer
2k
views
Async tcp socket client: send multiple requests with one connection
I'm new to socket programming and c++. I have a the following method that sends an array to server and receives sum of the array, I tried to make it async.
...
4
votes
2
answers
3k
views
C++ sockets: Sending structs for P2P communication
Two parties communicate over a network sending back and forth up to 100 messages. Each message sent is a response to the last received message and depends on it.
This means that both parties have to ...
10
votes
2
answers
844
views
A Server and Client Chatroom Using Sockets and Threading
I made a chatroom with a server and client python files, using Sockets and Threading as a project. I'm interested to acquire ...