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
29
votes
3answers
2k views

Java method - levels of abstraction

In his Clean Code book, Robert C. Martin states that functions should do only one thing and one should not mix different levels of abstraction. So I started wondering whether the code below meets ...
23
votes
2answers
8k 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 ...
18
votes
2answers
3k views

Python bot to answer mathematical questions for a remote server

The MSP Tech Club puts on an annual CTF, available here. I've worked on a solution but was wondering if there's a better way to write it or if I have any particular bad habits showing themselves? The ...
18
votes
1answer
3k 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. ...
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 ...
15
votes
3answers
116k views

Client/server implementation in C (sending data/files)

I wrote this code to send any binary file from server to client (in our example, I am sending sample_file.txt); the client should recreate the file locally. Code works fine (I tested with one or two ...
14
votes
3answers
2k views

Simple HTTP Server

I'm working on a project (studying) and I have a lot of time for proof of concepts and write something from scratch. Basically I'm creating an HTTP server (simple, but not too simple) in C++ using ...
14
votes
4answers
55k views

Checking if a port is in use

Review this code, which should return true if a port is in use or false if the port is not in use. Clarification: "In use" ...
14
votes
1answer
2k views

Stream that opens an HTTP GET and then acts like a normal C++ istream

Needed a quick stream to get JSON objects. ...
14
votes
1answer
1k views

First socket class

I want my socket class to be reviewed, including recommendations and optimizations. Sokect.hpp ...
13
votes
3answers
5k views

Replacing Skype, reinventing the chat client

I'm creating a chat client and chat server after a several month programming hiatus. The goal is to make one with features I want but it's also a learning project. Although it's mostly because I'm ...
13
votes
4answers
28k 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: ...
12
votes
3answers
2k 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. ...
11
votes
3answers
2k views

Windows socket class

I need some advice to see if my simple Windows socket class is good enough to be used in a simple chat application. ...
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: ...
11
votes
2answers
2k views

Command line IRC client

I made this IRC client ages ago in Python, and thought I'd revisit it for Python 3.5 (I'd like to play with asyncio). Before I start, I'd like to have an overall design review about this. Known ...
11
votes
2answers
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 ...
10
votes
2answers
65k views

TCP async socket server client communication

I develop my first async TCP socket server and client program in c# and would like to review the first parts of it. I like to get some information’s about smelly code that I missed and what I could ...
10
votes
2answers
9k views

Python Port Scanner

This is only my third Python script. Be brutal with me. Any tips, tricks, best practices, or better usages would be great! ...
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 - ...
10
votes
2answers
5k views

Echo server with CompletableFuture

I recently wrote a simple echo server in Java 7 using the NIO APIs so it was asynchronous and non-blocking. Then I decided, as a learning experience, to redo it with Java 8 hoping to use a more ...
10
votes
1answer
177 views

Point to point file transfer through HTTP socket

Why did I write this code This has a fun cartoon describing the problem of file transfer nowadays. And it's utterly true. There are already some webRTC based P2P file transfer services online. But I ...
10
votes
2answers
4k views

Mocking socket calls in C++

Explanation I'm trying to get better unit test coverage of my server. I needed to mock out some system libraries (I could not find anything that worked easily for C++). Because I did not want to do ...
10
votes
1answer
426 views

HTTP Stream Part 2 A stream that opens an HTTP GET and then acts like a normal C++ istream

The review I asked for yesterday was for a header only library. Stream that opens an HTTP GET and then acts like a normal C++ istream This has some limitations as it downloads all the data as part of ...
10
votes
1answer
50k views

Java multi-thread file server and client

My task was to build a multi-thread file server and a client that can upload or download a named file over sockets. It is assumed that the client will finish after its operation and there is no need ...
10
votes
1answer
3k 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 ...
9
votes
1answer
24k 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 ...
9
votes
3answers
130 views

Parse string into a struct

I'm writing a C application for the Networking course at the University. Basically it's a UDP server that can receive two commands: GET key SET key value That are ...
8
votes
2answers
37k 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 ...
8
votes
1answer
1k views

Python scanner for the first free port in a range

I have a distributed application (YARN), which runs a WebApp. This application use a default port to start (8008), before I start I need to check if port is in use. A container may run in the same ...
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 ...
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 ...
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 ...
8
votes
1answer
17k views

Multi-threaded server socket

I'm somewhat new to network programming. I have a server that uses Ubuntu, which needs to send data quickly to about 50 clients. As of now, I have about 50 concurrent connections (of course), and 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 ...
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 ...
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 ...
8
votes
1answer
2k views

C# Async Socket Wrapper

I'd like to get a little feedback on this async socket wrapper. My goal is to merge socket Begin/End methods into a single async call. I also wanted to wrap exceptions so they are easier to handle in ...
8
votes
1answer
661 views

A program to proxy MDNS requests to the DNS server

I wrote a program to proxy MDNS requests in a local network to the DNS server. This is useful because in some private networks, host names ending in ".local" are configured in the DNS server. But "....
8
votes
1answer
89 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 ...
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 ...
7
votes
2answers
673 views

Network Interface Object

I wrote a Network... thing (not really telnet); and it's pretty simple. No options, just straight I/O. It seems programs get so bloated easily. ...
7
votes
3answers
390 views

PlayerConnection class for Gaming Emulator

I have programmed a Gaming Emulator in C# and I have a class to handle all the connection side of things for the player, here we continuously listen for packets (each packet has a ID like a number, ...
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: ...
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 ...
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'...
7
votes
1answer
4k 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: ...
7
votes
1answer
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, ...
7
votes
1answer
3k views

Event-based multi-client socket wrapper

For learning purposes I am trying to develop an event-based library/wrapper to communicate with many clients by using epoll. The wrapper was designed with the ...
7
votes
1answer
675 views

Server-side of a chat application

I have written a server-side and the client-side of a chat application. I would like to improve it and I am unsure about my server construct and have absolutely no idea if there is a better way to do ...

1
2 3 4 5 6