10.Connecting to server from client

First, You need to create a client object with Proud.CNetClient.Create. Then Proud.CNetClient instance will be returned.

Next, you need to request connecting to server by calling Proud.CNetClient.Connect. Proud.CNetClient.Connect gets returned instantly and from that point on, you can start client loop unitll Proud.INetClientEvent.OnJoinServerComplete arrives.

If you receive Proud.INetClientEvent.OnJoinServerComplete event from client, then the process of connecting to server is completed. At this time, the success or fail of connection with server must be determined.

10.1Events that could occur while client is connecting to server

When Proud.CNetClient.Connect is executed, Proud.INetServerEvent.OnConnectionRequest will come from server. Proud.INetServerEvent.OnConnectionRequest offers an opportunity to deny the client trying to connect to server.

When Proud.INetServerEvent.OnConnectionRequest accepts the client to connect to server, the process of linking will be completed then client will receive Proud.INetClientEvent.OnJoinServerComplete at the same time server receives Proud.INetServerEvent.OnClientJoin.

10.2Exchanging custom data while connecting to server

그림 10-1The process of connecting to server from client