forked from youngmonkeys/ezyfox-server-csharp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EzyUTClient.cs
48 lines (42 loc) · 1.38 KB
/
EzyUTClient.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using com.tvd12.ezyfoxserver.client.constant;
using com.tvd12.ezyfoxserver.client.entity;
using com.tvd12.ezyfoxserver.client.config;
using com.tvd12.ezyfoxserver.client.socket;
using com.tvd12.ezyfoxserver.client.request;
namespace com.tvd12.ezyfoxserver.client
{
public class EzyUTClient : EzyTcpClient
{
public EzyUTClient(EzyClientConfig config) : base(config)
{
}
protected override EzyTcpSocketClient newTcpSocketClient()
{
return new EzyUTSocketClient();
}
public override void udpConnect(int port)
{
((EzyUTSocketClient)socketClient).udpConnect(port);
}
public override void udpConnect(String host, int port)
{
((EzyUTSocketClient)socketClient).udpConnect(host, port);
}
public override void udpSend(EzyRequest request)
{
Object cmd = request.getCommand();
EzyData data = request.serialize();
send((EzyCommand)cmd, (EzyArray)data);
}
public override void udpSend(EzyCommand cmd, EzyArray data)
{
EzyArray array = requestSerializer.serialize(cmd, data);
if (socketClient != null)
{
((EzyUTSocketClient)socketClient).udpSendMessage(array);
printSentData(cmd, data);
}
}
}
}