Skip to content

Commit

Permalink
Do dealy
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed May 30, 2021
1 parent 02ba9b2 commit cda5f1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static class Program
{
public static TcpClient client; // μ„œλ²„μ™€ μ—°κ²°λœ TCP μ†ŒμΌ“
public static NetworkStream ns; // λ„€νŠΈμ›Œν¬ 슀트림
public static readonly string hostname = "127.0.0.1"; // 접속할 μ„œλ²„ μ£Όμ†Œ
public static readonly string hostname = "klas.iptime.org"; // 접속할 μ„œλ²„ μ£Όμ†Œ
public static readonly ushort port = 6756; // 접속할 μ„œλ²„ 포트
public static Thread recvThread; // μ„œλ²„λ‘œλΆ€ν„° μˆ˜μ‹ μ„ λŒ€κΈ°ν•˜λŠ” μŠ€λ ˆλ“œ
public static Dictionary<PacketType, Action<Packet>> callback; // νƒ€μž…μ— λ”°λ₯Έ 콜백 λ©”μ†Œλ“œ
Expand Down Expand Up @@ -60,6 +60,7 @@ static void Recieve()
try
{
ns.Read(readBuffer, 0, readBuffer.Length);
Thread.Sleep(200);
}
catch (ThreadAbortException)
{
Expand All @@ -86,7 +87,17 @@ static void Recieve()
readLength = Packet.BUFFER_SIZE;

// νŒ¨ν‚· λ²ˆμ—­
object pakcetObj = Packet.Deserialize(readBuffer);
object pakcetObj = null;
try
{
pakcetObj = Packet.Deserialize(readBuffer);
}
catch (Exception ex)
{
formMain.Invoke(new MethodInvoker(() =>
MessageBox.Show(formMain, ex.Message, "Deserialize",
MessageBoxButtons.OK, MessageBoxIcon.Error)));
}
if (pakcetObj == null) continue;
Packet packet = pakcetObj as Packet;

Expand Down
1 change: 1 addition & 0 deletions Server/Classes/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void Recieve()
try
{
ns.Read(readBuffer, 0, readBuffer.Length);
Thread.Sleep(200);
}
catch (IOException socketEx)
{
Expand Down

0 comments on commit cda5f1b

Please sign in to comment.