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. #include <iostream> #include <string> #include <Windows.h> class Socket { private: WSADATA wsaData; SOCKET hSocket; sockaddr_in service; std::string addr; USHORT port; int exitCode; bool initializeWSA(); bool initializeSocket(); bool bind(); bool listen(); bool connect(); … Read more

One to One network file transfer code C# socket based

I have been developing a piece of software which has a central computer talk to many smaller nodes with a star network configuration. Each smaller node sends a file around 5MB in size once the central computer requests it This all happens at the same time so there will be no traffic on the network … Read more

File Transfer over TCP

I’m working on an Asynchronous TCP Client/Server using the old BeginXXX and EndXXXSocket API. The goal of this hobby project is to have a working multi user chat with file sharing capabilities. Here’s my code to Send the file public class Client { public readonly AutoResetEvent SendSync = new AutoResetEvent(true); public Action<Client, byte[]> OnReceive; public … Read more

Capsulation solution for byte arrays

In a part of the project, I had to implement a solution for encapsulation of byte arrays. We do use ssh and secure ports for socket connection but I was in need of an extra layer of protection against man-in-the-middle attacks or a mechanism to drop packages rather fast before reading all the package content. … Read more

Java Networking Framework

So I’ve just written a framework that is supposed to make it easier to create a network-based application (client-server) using the native java.net package. I was wondering if the structure of my code is well understandable and if there are ways to improve my code (in both, readability and performance). I provided a UML-diagram to … Read more

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. After two weeks of research, I’ve written the following program. I thought to share it with the community to detect issues that can be improved, and add a resource for OpenSSL … Read more

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 clients. Can you criticize my simple chat? Any possible improvements and changes are welcome. I have 2 classes and 2 objects … Read more

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 multi-threading before and would like the code reviewed for code correctness, best practices, and potential issues regarding how I’m handling threading. … Read more

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 listening for incoming messages and another thread accepting user input to send messages. from socket import AF_INET, … Read more

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: unconnected2, bound_to_address, listening and connected. To implement this I use move semantics and constructed to move construct on class of object from … Read more