forked from hiram3512/HiSocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample1.cs
More file actions
41 lines (35 loc) · 919 Bytes
/
Example1.cs
File metadata and controls
41 lines (35 loc) · 919 Bytes
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: hiramtan@live.com
***************************************************************/
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)
{
}
}
}