-
Notifications
You must be signed in to change notification settings - Fork 100
/
Example1.cs
41 lines (35 loc) · 919 Bytes
/
Example1.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
/***************************************************************
* Description:
*
* Documents: https://github.com/hiramtan/HiSocket
* Author: [email protected]
***************************************************************/
using HiSocket.Tcp;
namespace HiSocket.Example
{
class Example1
{
static void Main(string[] args)
{
}
TcpConnection tcp;
void Connect()
{
var package = new PackageExample();
tcp = new TcpConnection(package);
//tcp.OnConnecting+=
//tcp.OnDisconnected+=
tcp.OnConnected += OnConnected;
tcp.OnReceiveMessage += OnReceive;
tcp.Connect("127.0.0.1", 999);
}
void OnConnected()
{
//connect success
tcp.Send(new byte[10]);
}
void OnReceive(byte[] message)
{
}
}
}