Questions tagged [socket]

An endpoint of a bidirectional inter-process communication flow. This often refers to a process flow over a network connection, but by no means is limited to such.

Filter by
Sorted by
Tagged with
6
votes
1answer
415 views

Simple Echo Server

I wrote this echo server in Haskell as a way to introduced myself to programming with sockets in Haskell and generally practice Haskell. The echo server has a simple purpose: accept connections from a ...
3
votes
2answers
252 views

Assessment of client-server program source code

Can you assess source code of my client-server program? I would like to get an advice about design, code security etc. Thank you very much. The program does the following: Show files in ...
6
votes
2answers
4k views

Multithreaded Network Server

I would like the following code reviewed: I am trying to create a local server which listens indefinitely and provides the latest information. The server runs another while loop which fetches ...
11
votes
2answers
218 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: ...
15
votes
5answers
952 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 ...
10
votes
4answers
227 views

Impromptu TCP sender/receiver

Every once in a while I need to get some random computer thing done; so I write something to do it for me. This is one of those. It needed to be able to send text to, and receive text from, a server - ...
8
votes
1answer
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 ...
5
votes
3answers
130 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 ...
3
votes
1answer
510 views

Using C++11 move semantics to implement state pattern

I'm implementing a C++ layer on top of the sockets api of the OS (i.e. man 7 socket)1. Tcp sockets go through various states. Using the RAII principle leads to distinguishing the states: ...
6
votes
2answers
2k 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: ...
7
votes
1answer
2k views

C Socket API Call with Swift

I have a small function in Objective-C which uses the C Socket API to check if the device has an active internet connection: ...
-4
votes
1answer
3k views

Multi client chat application

I want this code to be reviewed, please. chatServer.java ...
7
votes
2answers
6k 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 ...
1
vote
1answer
4k views

Receiving all data comes from web in system.net.socket

I listen on a port via multi thread async socket. That port receives requests over XDomainRequest. I received the complete data each time till now but I don't trust this code because it may not work ...
1
vote
1answer
491 views

Erlang parallel server using sockets

The task was to build a simple parallel server in erlang that prints what it receives through a socket and alerts when the socket is closed. ...
-3
votes
2answers
888 views

Socket server class [closed]

I am trying to build a high performance socket server and this is what I have come up with so far. Can anyone please review my code and see if I can make any improvements on it? ...
8
votes
1answer
4k 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 ...
2
votes
1answer
1k views

Listening for several connections in an async method

Is there a better way to structure a method that returns a task that queues several inbound socket connections? ...
1
vote
0answers
53 views

NodeJS socket for handling errors

It's the first time managing Mongoose by socket.io and I'm wondering if this could be a good way: ...
3
votes
1answer
187 views

My Own ThreadPool implementation

I tried to make a Server using Java with a Thread Pool. Any review is welcome: ...
4
votes
1answer
395 views

Multi-Threaded Java Server

As practice I wanted to write a Socket in Java: ...
3
votes
1answer
1k views

Adding new sockets and sessions

I am currently writing a TcpListener class where it begins a new socket and adds a new Session. I have classes called ...
3
votes
1answer
3k views

2 way communication Python socket

I'm trying to create a 2 way communication socket in python. The socket will listen for connections from the client until it gets the data formatted in string like this: 'PHONENUMBER|STATUS'. I will ...
6
votes
1answer
40k 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 ...
2
votes
1answer
301 views

HTTP client similar to cURL

I'm writing my own HTTP client, kinda like cURL. (I already know I'm reinventing the wheel, this is more or less getting an inside look of HTTP 1.x before 2 becomes a thing.) So far pages download ...
1
vote
0answers
2k views

Server socket implementation with Python asyncio

I want a socket server implementation with the Python asyncio library. I have this code but I don't know if it's correct. I want to implement SSL, too. I used code from the documentation example and ...
8
votes
1answer
3k 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 ...
4
votes
1answer
679 views

Passing API data chunk per chunk to its socket clients every M seconds

Let's say that I want to query some API which will respond with array of random numbers: [4, ..., 17, ..., 25] To keep things simple enough, let's say that array has always 10 elements. For every ...
2
votes
1answer
2k views

TCP Server with multithreading

I am working on a banking application. I want to create a multithreaded TCP Payment Card (iso8583) server that can handle passbook printing requests simultaneously. Multiple devices are connected to ...
4
votes
2answers
10k views

Multi threaded TCP server

I wrote this just for fun, to hone my exception handling skills. I want to know what I can do better in terms of exception handling (and otherwise) in the below code Server ...
4
votes
1answer
673 views

Simple One Way IPC Implementation for pcntl_fork

It is a common task for me to need to run many nearly identical child processes. Not often but sometimes I need those child processes to communicate their results back to the parent process. I have ...
7
votes
6answers
4k views

Reading a line of text from a socket

I tend to write code, with very few comments, and few line breaks. I'm currently just a student at a University. I've had professors tell me one way or another to comment, but I have a hard time with ...
2
votes
1answer
4k views

Simple TCP Client Server application with receive side only

I wrote simple TCP Client Server application, I was wonder could you please review my code. I would be grateful for any hints and tips regarding to logic of app, coding style or naming convention. ...
8
votes
2answers
1k views

Sockets and networking for a multi-platform game

I'm in the process of adding network support for a little Mac & Windows game I'm writing. Today I've finished the basic sockets plus a few other network helpers and would appreciate having the ...
1
vote
1answer
377 views

Reading/writing null-terminated strings from socket

I need to handle C style ('\0' delimited) strings from/to a socket and came up with this as a first attempt: ...
3
votes
2answers
9k views

Primitive Python P2P Socket Chat

Here is my code for a Python script for a peer to peer chat system on a network using sockets. I know there are some things that could be changed so there would be less repetition in the code and ...
7
votes
1answer
117 views

Dictionary synonym lookup via networking

I have a small TCP service running on port 4444 which, given a word, will look up synonyms in a dictionary. Below is my Scala code for connecting to the socket, sending the lookup command and parsing ...
7
votes
2answers
1k views

Mimicing a TCP connection

I've recently started a new job and been drafted on to a project that's running late. My task was initially to add Bluetooth connectivity to a C# app, but at the request of a more senior colleague I'...
3
votes
2answers
1k views

Mutual friends finder written in Python

I've written a server/client tool which can "check the Six degrees of separation theory" in Russian social network VK.com. Client sends task (which contains two VK IDs) and Server tries to find all ...
6
votes
1answer
10k views

Interrupting a ServerSocket#accept() and shutting down a multi-threaded socket server

I have some code in progress that does multi threaded communication via sockets. I am using a poison pill to shut it down. It is a local port number. Is there a better way to shut it down gracefully? ...
3
votes
1answer
583 views

Refactoring this producer consumer class to minimize what is exposed

I don't like the service class below, specifically, the way it exposes the internals of the producer. While it would be possible to combine all three classes into one producer-consumer, I would ...
8
votes
1answer
2k views

Simple chat console app

I wanted to practice using sockets and multithreading. This is simple code where I start a Server and connect to it via Client ...
2
votes
3answers
20k views

Adding a timeout to an UDP socket server

I use a thread to read from a UDP socket. Afterwards the string gets parsed. In another thread I send to every connected client via this socket. I would like to keep latency and resources for running ...
6
votes
3answers
1k views

Read partial socket message

I've written some code that is suppose to read socket all the time and when needed return the partial data from it. I just want the response to send a command. It works, but this is a bit messy ...
1
vote
2answers
4k views

UDP server and JSON parser script

I am a Python beginner and wrote a script which should run on a Raspberry PI as a UDP server. It reads and writes to a serial device and has to process and forward JSON strings. Because there is ...
2
votes
4answers
851 views

Silent Try_catch in high load socket server or not?

I'm working on a socket application that will listen to incoming messages from about 400 devices. They all send a message at least once per minute. Now I have a working program and it has been running ...
7
votes
2answers
2k views

Proxy using socket, doubts on multithreading and connection closing

I'm trying to make a simple proxy server in Python using the socket library, mostly to understand how it works. I'm a noob both at programming and networking, so please be nice if my questions are ...
6
votes
1answer
19k views

Socket HTTP post request

I am working on a socket HTTP post request. Here is one method that I come up with. It looks dirty and is in C instead of C++. ...
3
votes
1answer
187 views

Getting the current chat room ID

I need roomId (an auto_increment primary key) to locate a specific room to update chat info. My way of doing it right now is ...
8
votes
1answer
9k views

Multi-threaded socket server high load

I'm trying to make a backend for QuizUp like application: user connects to a server, sends credentials and gets paired up with another user. After that server handles each pair, periodicaly sending ...