Skip to content

TCP Server, Console TCP Client, and Unity3d TCP Client examples

Notifications You must be signed in to change notification settings

dilmerv/TCPServerAndClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCPServerAndClient

This project contains examples for creating a TCP Server in .NET Core, a TCP Client in .NET Core, and also a TCP Client for Unity3d projects.

Examples listed below:

TCP Server:

To Start a server:

  Thread serverThread = new Thread(() => new Server("127.0.0.1" , 13000));
  serverThread.Start();
            

Unity TCP Client:

To create a new client connection from Unity:

    new Thread(() => {
        Thread.CurrentThread.IsBackground = true;
        ConnectClient(serverIPAddress, port, clientId, $"ClientId: {clientId} sending a message...");
    }).Start();
        

To Dispatch events / messages to the main thread:

  Dispatcher.Instance.Enqueue(() => Message(clientId, $"Sent: {message}"));      

Console TCP Client

  new Thread(() => {
      Thread.CurrentThread.IsBackground = true;
      ConnectClient("127.0.0.1", 13000, $"ClientId: {1} sending a message...");
  }).Start();

About

TCP Server, Console TCP Client, and Unity3d TCP Client examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published