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
5
votes
2answers
636 views

Socket class for use in web server

I've created this socket class to use in my web server application. I have two classes: one for the socket and the other for the webserver. ...
6
votes
1answer
252 views

Checking web-page repeatedly

I have a program that gets 5 random dice throws from random.org over and over. In order to avoid doing getaddrinfo() over and over with the exact same data, I moved ...
8
votes
1answer
16k 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 ...
15
votes
3answers
115k 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 ...
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. ...
3
votes
1answer
3k views

Run a TCP server listening for incoming messages

I've written the following code, but I need some review on design style. I want to develop a library/module and expose an API to client programs. How do I do that? The code just runs a TCP server ...
4
votes
1answer
2k views

A polling wrapper for Python's socket library

Even though I am working with one socket, I have wrapped it with an object which allows .recv() method which accepts timeout, using Python's ...
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 ...
10
votes
1answer
422 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 ...
4
votes
1answer
2k views

Turning a Java console app into a server

I'm not familiar with Java at all, so I'd like to get some feedback on this piece of code. I made it by looking at a few Hello World-esque Java server examples, so it may have drawbacks I'm not ...
9
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! ...
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. ...
2
votes
2answers
1k views

File locking between server threads

I have written the below code where the server is getting requests from clients on a socket and creating a thread per client. Each client thread is then writing to a file which is common to all the ...
14
votes
4answers
53k 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" ...
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, ...
2
votes
1answer
196 views

Extract location from HTTP socket

I have the following HTTP reply saved in a local file called source.txt: ...
1
vote
1answer
366 views

Improving performance of Ruby socket programming

Server: ...
2
votes
3answers
16k views

Detecting socket disconnect in .NET

First off, I know there are other solutions and practices but I'm referring to MS proposed code from .NET documentation. It goes like this: ...
4
votes
1answer
4k views

Transfer log file between client and server while updating files automatically

All this code does is transfer the files. In order to make changes to the file, one has to re-transfer the file. During this time, I stand by to automate the update operation, where the server ...
8
votes
1answer
654 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 "....
2
votes
1answer
1k views

Proper cleanup in multithreaded client/server code

For a university project I'm trying to build a system that has a general architecture of: Client app <=====> Client library < - - > Server library <=====> Server app I'm trying to make the ...
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 ...
1
vote
1answer
74 views

Action to transmit queued messages over a socket

I have this action and it works but looks rather clunky to me. Is there any way I could improve that? ...
2
votes
2answers
581 views

Wrapper library for sockets

I'm writing a C++ wrapper library for sockets which will hopefully be cross-platform. It's basically two headers: mizaru.hpp, which contains the wrapper classes themselves. trans_layer.hpp, which ...
2
votes
4answers
1k views

if-elseif chain. Is there a better pattern?

I'm working on a TCP Server using .NET and the following code is my first attempt to process the received data (from the socket) to create a packet to deliver. Basically, the packet has a header (7 ...
-1
votes
1answer
7k views

Stuck with Multi-Client Chat Application [closed]

I'm trying to make a MultiClient Chat Application in which the chat is implemented in the client window. I've tried server and client code for the same. I've got two problems: A. I believe the code ...
3
votes
2answers
4k views

Multi-threaded socket client for Scrolls

This is a multi-threaded socket client written to talk to the Scrolls socket server. The idea is to send commands to the socket server and respond to messages received via callbacks. I've never done ...
2
votes
1answer
5k views

Transmitting/Sending big packet safely using TcpClient/Socket

I am writing a TCP based client that need to send and receive data. I have used the Asynchronous Programming Model (APM) provided for Socket class by the .NET ...
1
vote
4answers
451 views

Echoing back input in uppercase over a socket with Hy, a Python Lisp dialect

I think I'd like to learn Clojure eventually, but at the moment am having fun with Hy, a "dialect of Lisp that's embedded in Python." ...
5
votes
1answer
19k views

Reusing thread and UdpClient for sending and receiving on same port

The working and functional code below is a simplification of a real test application I've written. It acts as a client which asynchronously sends UDP data from a local endpoint and listens for an echo'...
2
votes
2answers
922 views

How is this for a “Hello World” of socket programming?

I was trying out the Beej's guide to socket Programming and wrote this. Is there anything that I am obviously doing wrong? Any potential for buffer overflows? Segmentation faults? Any possible errors ...
2
votes
1answer
785 views

RTCPeerConnection signaling library

I created a library/npm module to handle the signaling process for RTCPeerConnection. There is still a good bit of work that needs done (error handling, dealing ...
10
votes
2answers
64k 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 ...
3
votes
1answer
132 views

Communication with GARMIN through WEB

I am developing a WEB based GPS system and one of its functionalities is to be able to send messages and routes to GARMIN devices. I have never been using sockets before, and for some (obvious) ...
2
votes
1answer
340 views

Port-scanning with two IPs

I am making a Python program with what I learned so far where the user enters two IPs that represents the start and end of the range of IPs to be scanned, then saves the wanted IP in a text file. <...
2
votes
0answers
2k views

Join / leave source-specific multicast group and connect / disconnect corresponding socket [closed]

I need to join source-specific multicast group and receive data. When I don't need to receive data anymore, I need to leave the group and disconnect the socket. Am I doing everything right? In ...
5
votes
1answer
5k views

Socket handling in a thread

I am building an app for android to control VLC (mediaplayer) that runs on my computer. At the moment it's just a prototype that works, but I was wondering if I am correctly managing my HandlerThread ...
2
votes
3answers
223 views

Properties and on change events

So I made a socket communication library. And a part of it is IConnection ...
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 ...
5
votes
1answer
3k views

Simple Socket class hierarchy

One of the things I wanted to do was make it impossible to forget to initialise or forget to cleanup WSA. Often the network examples will return as soon as an error occurs (say an socket didn't bind) ...
3
votes
3answers
7k views

Asynchronous SSLSTREAM

Recently I have written an SslStream class asynchronously authenticate clients and receive message from them. I still would like anyone to suggest improvements for ...
3
votes
1answer
2k views

Basic socket library in C

I am trying to learn C and have written a very basic socket library. I would be interested in any general design and coding comments. Note that at this stage I am not bothered about implementing the ...
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 ...
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: ...
6
votes
2answers
14k views

Asynchronous Sockets

I need to implement a TCP client application. The client and the server send messages to each other. I want to make this program scalable enough to handle connections to multiple servers at the same ...

1 2 3 4 5
6