An open API service indexing awesome lists of open source software.

https://github.com/gytis-ivaskevicius/synchronoustcpserverlibrary

Simple Synchronous TCP Server Library written in C#.
https://github.com/gytis-ivaskevicius/synchronoustcpserverlibrary

easy-to-use library tcp-server tcp-socket

Last synced: 3 months ago
JSON representation

Simple Synchronous TCP Server Library written in C#.

Awesome Lists containing this project

README

        

# SynchronousTCPServerLibrary
Simple Synchronous TCP Server Library written in C#.
#Documentation

## startListening(int port, int backlog)
1. port - Port on which server should run.
2. backlog - Maximum number of permitted connections.

Notes: Starts server in the same thread, in other words - everything that goes after this method wont be executed untill server is stoped. To avoid it - read below.


## startListeningInSeperateThread(int port, int backlog)
1. port - Port on which server should run.
2. backlog - Maximum number of permitted connections.

Notes: Creates thread in which it listens for connestions.


## closeServer()
Notes: Closes server.


## send(Socket socket, string message)
1. socket - Socket aka client.
2. message - message that you want to send.


## sendln(Socket socket, string message)
1. socket - Socket aka client.
2. message - message that you want to send.

Notes: Same as "send" but adds "new line" symbol at the end of the message.


## broadcast(string message)
1. message - message that you want to broadcast.

Notes: Broadcasts message to all clients.


## broadcastln(string message)
1. message - message that you want to broadcast.

Notes: Broadcasts message(with "new line" symbol) to all clients.


## kick(Socket socket)
1. socket - Disconnects socket(client) of ur choice.


## kickAll()
Note: Disconnects all sockets.


# Delegates
1.onConnect

2.onDisconnect

3.onDataReceive