Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michal34512/tcp-connection
This is a basic C# implementation of a TCP connection between two hosts
https://github.com/michal34512/tcp-connection
connection messages tcp tcp-client tcp-server
Last synced: 15 days ago
JSON representation
This is a basic C# implementation of a TCP connection between two hosts
- Host: GitHub
- URL: https://github.com/michal34512/tcp-connection
- Owner: michal34512
- License: mit
- Created: 2023-07-15T01:54:48.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-15T02:17:41.000Z (over 1 year ago)
- Last Synced: 2023-07-15T03:22:18.969Z (over 1 year ago)
- Topics: connection, messages, tcp, tcp-client, tcp-server
- Language: C#
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# TCP Connection
Simple connetion between two hosts based on TCP protocol.# Establishing connection
Server:
```diff
# Starting server
Connection.Port = 7777;
Connection.Start_Connection(Connection.ConnectionRole.Server);
```
Client:
```diff
# Connecting to server
Connection.Port = 7777;
Connection.IpServ = "127.0.0.1";
Connection.Start_Connection(Connection.ConnectionRole.Client);
```# Sending & receiving messages
Sending:
```diff
# Sending messages
string mess = Console.ReadLine();
Connection.SendMessage(Encoding.UTF8.GetBytes(mess));
```
Receiving:
```diff
# Receive messages
List messages = Connection.ReceiveMessages();
if (messages != null)
foreach (byte[] mess in messages)
{
Console.WriteLine(Encoding.UTF8.GetString(mess));
}
```