https://github.com/unitycoder/unity_tcp
async/await TCP socket implementation for Unity3d.
https://github.com/unitycoder/unity_tcp
Last synced: 8 months ago
JSON representation
async/await TCP socket implementation for Unity3d.
- Host: GitHub
- URL: https://github.com/unitycoder/unity_tcp
- Owner: unitycoder
- Created: 2019-10-11T05:56:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-30T09:44:54.000Z (over 6 years ago)
- Last Synced: 2025-02-13T20:52:29.897Z (10 months ago)
- Homepage:
- Size: 55.7 KB
- Stars: 8
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unity TCP
async/await TCP socket implementation for Unity3d.

# How to use
## As a server
1. Attatch `UnityTCP.cs` to arbitary GameObject
2. Change socket type to `Server`
3. Set port number you want to open
4. Set some callback events
- `OnMessage` returns received string message
- `OnEstablished` called when connection is established and returns connected TcpClient
- `OnDisconnected` called when connection is lost and returns disconnected client's Endpoint
## As a client
1. Attatch `UnityTCP.cs` to arbitary GameObject
2. Change socket type to `Client`
3. Set host address and port number you want to access
4. Set `OnMessage` callback event
- this will be called when a server send message to you
# Sample
Sample scene is included in `Assets/UnityTCP/Sample.unity`