skywind3000 / kcp

:zap: KCP - A Fast and Reliable ARQ Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple multi-thread clients, one server

nominalval opened this issue · comments

Hello.

Your library is great but it is safe threads and multiple clients?

Consider that you have 100+ clients send data on the same channel

SERVER:

ikcpcb *kcp1 = ikcp_create(0x11223344, (void*)0);

MULTIPLE multithreaded CLIENTS (100+) sending at high rate (maybe 1000 messages/sec):

ikcpcb *kcp1 = ikcp_create(0x11223344, (void*)0);

thread()
{
...
ikcp_send(kcp1, buffer, 8);
...
}

It is safe to do this?

I am interested in delivering text data as fast as possible. I don't care about the id and who sends. Client can have a random id, but i see that you have to specify it at server side.

Thank you.

it is a pure state machine (intentionally prevent calling any system api).

So apparently you should write thread-safe code yourself.

I will try to write this and share it after.

Where i can find some examples of server-client for C?