EasyTCP | Unity TCP Server-Client | Demo
A downloadable tool for Windows, Linux, and Android
π EasyTCP for Unity
π Overview
EasyTCP is a lightweight Unity networking package designed to simplify TCP communication between applications.
It provides both Server and Client functionality using background threads and async/await, ensuring smooth performance without blocking the Unity main thread.
Perfect for:
- β Multiplayer prototyping
- β Remote debugging / telemetry
- β Cross-app communication (PC β Mobile β Embedded)
- β IoT/game integrations
π¦ Installation
Option A — Install via Unity Package Manager (Git URL)
- Open Unity β Window β Package Manager
- Click + β Add package from Git URL
- Paste: https://github.com/IreshSampath/unity-assets-easy-tcp.git
- Click Install
- Click Import β Samples β Server Sample or Client Sample.
- Click + β Add package from Git URL
- Paste: https://github.com/IreshSampath/unity-assets-easy-ui-console.git
- Click Install
- Click Import β Samples β EasyUIConsole Sample
π§° Quick Start
β Check Samples
- Open the TCP Server scene or the TCP Client scene.
- Check the Handlers scripts (TCPServerHandler.cs/TCPClientHandler.cs).
- Server-side, IP is any, and Port 5000 is already set up.
- Client-side, Need to save Server IP and Port
β Server Setup β Check the "TCPServerHandler.cs"
// Receive messages from clients
void OnEnable()
{ TCPServer.OnMessageReceived += ReceiveMessage; }
void ReceiveMessage(int id, string name, string msg)
{ EasyUIConsoleManager.Instance.EasyHiglight($"{id} {name} {msg}"); }
// Send to all connected clients
TCPServer.Instance.SendMessageToAllClients("Hello Clients!");
// Send to a specific
client TCPServer.Instance.SendMessageToClient(clientId, "Private Message");
β Client Setup β Check the "TCPClientHandler.cs"
//Need to save Server IP and Port
PlayerPrefs.SetString("ServerIP", ipAddress.ToString());
PlayerPrefs.SetInt("Port", portNumber);
// Connect to the server
TCPClient.Instance.ConnectServer();
// Disconnect when done
TCPClient.Instance.DisconnectServer();
// Receive messages from server
void OnEnable()
{ TCPServer.OnMessageReceived += ReceiveMessage; }
void ReceiveMessage(string msg)
{ EasyUIConsoleManager.Instance.EasyHiglight(msg); }
// Send messages to server
TCPClient.Instance.SendMessageToServer("Hello Server!");
β οΈ IMPORTANT: READ BEFORE CONNECTING!
To avoid connection failures, make sure:
β
Server and Client are on the SAME NETWORK
β’ Connected to the same Wi-Fi / LAN router
β’ Hotspot / corporate networks may block local access
β
Firewall is NOT Blocking Your App (Windows Users)
β’ Disable Firewall temporarily, or
β’ Add an Allow Rule for your TCP app
β
Router Must Allow Device-to-Device Communication
β’ Some routers block internal ports — change to a home network if needed
β
Double-check IP & Port Values
β’ A single typo can stop the connection!
π’ Once all of the above are β , youβre good to go!
π§ͺ Samples Included
| Sample | Description |
|---|---|
| β EasyTCP Server Sample | Demonstrates accepting multiple clients and broadcasting messages |
| β EasyTCP Client Sample | Shows how to connect, send, and listen for messages |
βοΈ Technical Details
| Feature | Implementation |
|---|---|
| Threading Model | Background Threads + Async/Await |
| Communication | TCP (Transmission Control Protocol) |
| Encoding | UTF-8 (string-based messaging) |
| Supported Platforms | Windows / Mac / Linux / Android / iOS |
| UI Dependency (Optional) | EasyUIConsole (for visual debug logs) |
π License
This project is licensed under the MIT License — free for commercial and personal use.
π Thank You
Thanks for using EasyTCP!
- Feel free to contribute, report bugs, or request new features.
π€ Author
Iresh Sampath π LinkedIn Profile
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.