Skip to content

Gompangs/GNetClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GNetClient

This Project for Unity(3D) TCP Client.
Image of Yaktocat

Versions

0.1v - Under Development on now

Background

There are few projects in github which "correctly" work with TCP Unity3D.

I want use some library for my project, but many projects have lack of usage or very oldest of last commit.

So, I thought this is worthy to make library to Unity TCP Client who want to use simply like me.

Goal

The goal is simple. "working on Unity3D" and "Well working"

But, current state is unstable to use official. I'm trying enhance structures and build additional convenience for developer.

I'll release when it comes to stable version to use. (Not Recommend using now)

Usage(beta)

Below instructions must called sequencially.

First, get instance from NetworkManager(only one object will be created by Singleton)

GNetClient netClient = GNetClient.getInstance("127.0.0.1", 10100);

And, Adding Delegates for Network Operations.

netClient.OnConnect += OnConnect;
netClient.OnDisconnect += OnDisconnect;
netClient.OnReceive += OnReceive;

Last, Try Connect to Server

netClient.Connect();

Use After Connect()
Send data to server(It will be extent to more types)

byte[] someData;
netClient.Send(someData);

Receiving Data from Server -> OnReceive() function will called.

private void OnReceive(byte[] data)
{
    Console.WriteLine("Received : {0}", data.Length);
}

Reminder

References

Releases

No releases published

Packages

No packages published

Languages