Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michal34512/tcp-connection-unity
This is a basic C# Unity implementation of a TCP connection between two hosts
https://github.com/michal34512/tcp-connection-unity
Last synced: 15 days ago
JSON representation
This is a basic C# Unity implementation of a TCP connection between two hosts
- Host: GitHub
- URL: https://github.com/michal34512/tcp-connection-unity
- Owner: michal34512
- License: mit
- Created: 2023-07-15T20:11:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-15T20:34:23.000Z (over 1 year ago)
- Last Synced: 2023-07-15T21:24:38.151Z (over 1 year ago)
- Language: C#
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TCP Connection with Unity
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));
}
```