-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemp_Linsener.cs
49 lines (42 loc) · 1.18 KB
/
Temp_Linsener.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
49
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using UnityEditor.Sprites;
using UnityEngine;
public class Temp_Linsener : SYNC_Listener
{
public string des_IP;
public int des_Port;
public byte[] bytes = new byte[40];
public UdpClient m_sender;
UdpClient testSender = new UdpClient();
public void SEND_OC_JOIN(string name)
{
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(des_IP), des_Port);
IPAddress temp;
if (IPAddress.TryParse(des_IP, out temp) == false)
{
Debug.Log("string is sad");
return;
}
if (m_sender == null)
{
m_sender = new UdpClient();
}
m_sender.Send(OC_JOIN_PACKET(name),name.Length,iPEndPoint);
byte[] OC_JOIN_PACKET(string name)
{
byte[] temp = new byte[40];
temp.SEND_INT(0, 0);
temp.SEND_STR(4, name);
return temp;
}
}
public override void workFunc(RecvData recvData)
{
Debug.Log("[Test] start read opCode - " + recvData.m_OP);
bytes = recvData.m_buffer;
}
}