├── LICENSE
├── POCO_Net_Samples
├── Chatting_Server
│ ├── Chatting_Server.sln
│ ├── Chatting_Server.vcxproj
│ ├── Chatting_Server.vcxproj.filters
│ └── main.cpp
├── Csharp_Client
│ ├── App.config
│ ├── ChatClient1.csproj
│ ├── ChatClient1.sln
│ ├── ClientSimpleTcp.cs
│ ├── DevLog.cs
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── MainForm.resx
│ ├── PacketBufferManager.cs
│ ├── PacketDefine.cs
│ ├── PacketHandler.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ └── packages.config
├── POCO_Net_Samples.sln
├── block_echo_client
│ ├── block_echo_client.cpp
│ ├── block_echo_client.sln
│ ├── block_echo_client.vcxproj
│ └── block_echo_client.vcxproj.filters
├── block_echo_server
│ ├── block_echo_server.cpp
│ ├── block_echo_server.sln
│ ├── block_echo_server.vcxproj
│ └── block_echo_server.vcxproj.filters
├── block_echo_server_MD
│ ├── block_echo_server.cpp
│ ├── block_echo_server_MD.sln
│ ├── block_echo_server_MD.vcxproj
│ └── block_echo_server_MD.vcxproj.filters
├── block_echo_udp_client
│ ├── udp_client.cpp
│ ├── udp_client.sln
│ ├── udp_client.vcxproj
│ └── udp_client.vcxproj.filters
├── block_echo_udp_server
│ ├── udp_server.cpp
│ ├── udp_server.sln
│ ├── udp_server.vcxproj
│ └── udp_server.vcxproj.filters
├── config_TCPServer
│ ├── config_TCPServer.cpp
│ ├── config_TCPServer.sln
│ ├── config_TCPServer.vcxproj
│ └── config_TCPServer.vcxproj.filters
├── csharp_test_client
│ ├── App.config
│ ├── ClientSimpleTcp.cs
│ ├── DevLog.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── csharp_test_client.csproj
│ ├── csharp_test_client.sln
│ ├── mainForm.Designer.cs
│ ├── mainForm.cs
│ └── mainForm.resx
├── http_client
│ ├── SimpleHttpGetter.h
│ ├── SimpleHttpPoster.h
│ ├── http_client.sln
│ ├── http_client.vcxproj
│ ├── http_client.vcxproj.filters
│ └── main.cpp
├── http_server
│ ├── http_server.cpp
│ ├── http_server.sln
│ ├── http_server.vcxproj
│ └── http_server.vcxproj.filters
├── ini_reader
│ ├── ini_reader.sln
│ ├── ini_reader.vcxproj
│ ├── ini_reader.vcxproj.filters
│ ├── main.cpp
│ └── test.ini
├── multi_session_client
│ ├── multi_session_client.cpp
│ ├── multi_session_client.sln
│ ├── multi_session_client.vcxproj
│ └── multi_session_client.vcxproj.filters
├── multi_session_server
│ ├── multi_session_server.cpp
│ ├── multi_session_server.sln
│ ├── multi_session_server.vcxproj
│ └── multi_session_server.vcxproj.filters
├── name_resolution
│ ├── name_resolution.cpp
│ ├── name_resolution.sln
│ ├── name_resolution.vcxproj
│ └── name_resolution.vcxproj.filters
├── network_interfaceList
│ ├── network_interfaceList.cpp
│ ├── network_interfaceList.sln
│ ├── network_interfaceList.vcxproj
│ └── network_interfaceList.vcxproj.filters
├── non-block_echo_client
│ ├── non-block_echo_client.cpp
│ ├── non-block_echo_client.sln
│ ├── non-block_echo_client.vcxproj
│ └── non-block_echo_client.vcxproj.filters
├── non-block_echo_server
│ ├── non-block_echo_server.cpp
│ ├── non-block_echo_server.sln
│ ├── non-block_echo_server.vcxproj
│ └── non-block_echo_server.vcxproj.filters
├── parallelreactor_EchoServer
│ ├── parallelreactor_EchoServer.cpp
│ ├── parallelreactor_EchoServer.sln
│ ├── parallelreactor_EchoServer.vcxproj
│ └── parallelreactor_EchoServer.vcxproj.filters
├── reactor_EchoServer
│ ├── reactor_EchoServer.cpp
│ ├── reactor_EchoServer.sln
│ ├── reactor_EchoServer.vcxproj
│ └── reactor_EchoServer.vcxproj.filters
├── reactor_EcohoServerEx
│ ├── reactor_EcohoServerEx.cpp
│ ├── reactor_EcohoServerEx.properties
│ ├── reactor_EcohoServerEx.sln
│ ├── reactor_EcohoServerEx.vcxproj
│ └── reactor_EcohoServerEx.vcxproj.filters
├── simple_TCPServer
│ ├── simple_TCPServer.cpp
│ ├── simple_TCPServer.sln
│ ├── simple_TCPServer.vcxproj
│ └── simple_TCPServer.vcxproj.filters
├── socketConnector_client
│ ├── socketConnector_client.cpp
│ ├── socketConnector_client.sln
│ ├── socketConnector_client.vcxproj
│ └── socketConnector_client.vcxproj.filters
└── tcpserver_EchoServerEx
│ ├── tcpserver_EchoServerEx.cpp
│ ├── tcpserver_EchoServerEx.sln
│ ├── tcpserver_EchoServerEx.vcxproj
│ └── tcpserver_EchoServerEx.vcxproj.filters
├── README.md
├── Semina_2017-09-16
├── 01_block_echo_client
│ ├── block_echo_client.cpp
│ ├── block_echo_client.sln
│ ├── block_echo_client.vcxproj
│ └── block_echo_client.vcxproj.filters
├── 01_block_echo_server
│ ├── block_echo_server.cpp
│ ├── block_echo_server.sln
│ ├── block_echo_server.vcxproj
│ └── block_echo_server.vcxproj.filters
├── 02_non-block_echo_client
│ ├── non-block_echo_client.cpp
│ ├── non-block_echo_client.sln
│ ├── non-block_echo_client.vcxproj
│ └── non-block_echo_client.vcxproj.filters
├── 02_non-block_echo_server
│ ├── non-block_echo_server.cpp
│ ├── non-block_echo_server.sln
│ ├── non-block_echo_server.vcxproj
│ └── non-block_echo_server.vcxproj.filters
├── 03_reactor_EchoClient
│ ├── reactor_EchoClient.cpp
│ ├── reactor_EchoClient.filters
│ ├── reactor_EchoClient.sln
│ └── reactor_EchoClient.vcxproj
├── 03_reactor_EchoServer
│ ├── reactor_EchoServer.cpp
│ ├── reactor_EchoServer.sln
│ ├── reactor_EchoServer.vcxproj
│ └── reactor_EchoServer.vcxproj.filters
├── 04_reactor_EcohoServerEx
│ ├── reactor_EcohoServerEx.cpp
│ ├── reactor_EcohoServerEx.sln
│ ├── reactor_EcohoServerEx.vcxproj
│ └── reactor_EcohoServerEx.vcxproj.filters
├── 05_parallelreactor_EchoServer
│ ├── parallelreactor_EchoServer.cpp
│ ├── parallelreactor_EchoServer.sln
│ ├── parallelreactor_EchoServer.vcxproj
│ └── parallelreactor_EchoServer.vcxproj.filters
└── iniFileRead
│ ├── iniFileRead.sln
│ ├── iniFileRead.vcxproj
│ ├── iniFileRead.vcxproj.filters
│ ├── main.cpp
│ └── test.ini
├── Semina_2021-03-17
├── 01_block_echo_server
│ ├── block_echo_server.cpp
│ ├── block_echo_server.sln
│ ├── block_echo_server.vcxproj
│ └── block_echo_server.vcxproj.filters
├── 02_reactor_EcohoServerEx
│ ├── reactor_EcohoServerEx.cpp
│ ├── reactor_EcohoServerEx.sln
│ ├── reactor_EcohoServerEx.vcxproj
│ └── reactor_EcohoServerEx.vcxproj.filters
├── 03_parallelreactor_EchoServer
│ ├── parallelreactor_EchoServer.cpp
│ ├── parallelreactor_EchoServer.sln
│ ├── parallelreactor_EchoServer.vcxproj
│ └── parallelreactor_EchoServer.vcxproj.filters
├── ChatClient
│ ├── App.config
│ ├── ClientSimpleTcp.cs
│ ├── DevLog.cs
│ ├── Packet.cs
│ ├── PacketBufferManager.cs
│ ├── PacketDefine.cs
│ ├── PacketProcessForm.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── csharp_test_client.csproj
│ ├── csharp_test_client.sln
│ ├── mainForm.Designer.cs
│ ├── mainForm.cs
│ ├── mainForm.resx
│ └── packages.config
├── ChatServer
│ ├── ChatServer.h
│ ├── ChatServer.sln
│ ├── ChatServer.vcxproj
│ ├── ChatServer.vcxproj.filters
│ ├── ErrorCode.h
│ ├── Packet.h
│ ├── PacketID.h
│ ├── PacketManager.cpp
│ ├── PacketManager.h
│ ├── RecvRingBuffer.h
│ ├── Room.cpp
│ ├── Room.h
│ ├── RoomManager.h
│ ├── Session.h
│ ├── User.h
│ ├── UserManager.h
│ └── main.cpp
└── ChatServer_codeFlow.xlsx
└── exampleCodes
├── 04_block_echo_client
├── block_echo_client.cpp
├── block_echo_client.sln
├── block_echo_client.vcxproj
└── block_echo_client.vcxproj.filters
├── 04_block_echo_server
├── block_echo_server.cpp
├── block_echo_server.sln
├── block_echo_server.vcxproj
└── block_echo_server.vcxproj.filters
├── 05_block_echo_udp_client
├── udp_client.cpp
├── udp_client.sln
├── udp_client.vcxproj
└── udp_client.vcxproj.filters
├── 05_block_echo_udp_server
├── udp_server.cpp
├── udp_server.sln
├── udp_server.vcxproj
└── udp_server.vcxproj.filters
├── 06_non-block_echo_client
├── non-block_echo_client.cpp
├── non-block_echo_client.sln
├── non-block_echo_client.vcxproj
└── non-block_echo_client.vcxproj.filters
├── 06_non-block_echo_server
├── non-block_echo_server.cpp
├── non-block_echo_server.sln
├── non-block_echo_server.vcxproj
└── non-block_echo_server.vcxproj.filters
├── 07_simple_TCPServer
├── simple_TCPServer.cpp
├── simple_TCPServer.sln
├── simple_TCPServer.vcxproj
└── simple_TCPServer.vcxproj.filters
├── 08_changeSetting_TCPServer
├── changeSetting_TCPServer.cpp
├── changeSetting_TCPServer.sln
├── changeSetting_TCPServer.vcxproj
└── changeSetting_TCPServer.vcxproj.filters
├── 09_parallelreactor_EchoServer
├── parallelreactor_EchoServer.cpp
├── parallelreactor_EchoServer.sln
├── parallelreactor_EchoServer.vcxproj
└── parallelreactor_EchoServer.vcxproj.filters
├── 09_reactor_EchoClient
├── reactor_EchoClient.cpp
├── reactor_EchoClient.filters
├── reactor_EchoClient.sln
└── reactor_EchoClient.vcxproj
├── 09_reactor_EchoServer
├── reactor_EchoServer.cpp
├── reactor_EchoServer.sln
├── reactor_EchoServer.vcxproj
└── reactor_EchoServer.vcxproj.filters
├── 09_reactor_EcohoServerEx
├── reactor_EcohoServerEx.cpp
├── reactor_EcohoServerEx.sln
├── reactor_EcohoServerEx.vcxproj
└── reactor_EcohoServerEx.vcxproj.filters
├── 10_http_client
├── http_client.sln
├── http_client.vcxproj
├── http_client.vcxproj.filters
└── main.cpp
├── 10_http_server_01
├── http_server.cpp
├── http_server.sln
├── http_server.vcxproj
├── http_server.vcxproj.filters
└── index.html
├── 10_http_server_02
├── http_server.cpp
├── http_server.sln
├── http_server.vcxproj
└── http_server.vcxproj.filters
├── 10_http_server_03
├── http_server.cpp
├── http_server.sln
├── http_server.vcxproj
└── http_server.vcxproj.filters
├── 11_websocket_client
├── client.cpp
├── client.sln
├── client.vcxproj
└── client.vcxproj.filters
├── 11_websocket_server
├── server.cpp
├── websocket_server.sln
├── websocket_server.vcxproj
└── websocket_server.vcxproj.filters
└── csharp_test_client
├── App.config
├── ClientSimpleTcp.cs
├── DevLog.cs
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── csharp_test_client.csproj
├── csharp_test_client.sln
├── mainForm.Designer.cs
├── mainForm.cs
└── mainForm.resx
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Choi HeungBae
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Chatting_Server/Chatting_Server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chatting_Server", "Chatting_Server.vcxproj", "{FDA63F68-378C-4DC2-BA75-92224994AF10}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Debug|x64.ActiveCfg = Debug|x64
17 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Debug|x64.Build.0 = Debug|x64
18 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Debug|x86.ActiveCfg = Debug|Win32
19 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Debug|x86.Build.0 = Debug|Win32
20 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Release|x64.ActiveCfg = Release|x64
21 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Release|x64.Build.0 = Release|x64
22 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Release|x86.ActiveCfg = Release|Win32
23 | {FDA63F68-378C-4DC2-BA75-92224994AF10}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Chatting_Server/Chatting_Server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Chatting_Server/main.cpp:
--------------------------------------------------------------------------------
1 | // http://poco.roundsquare.net/2013/05/03/poconettcpserver/
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/ChatClient1.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatClient1", "ChatClient1.csproj", "{F3631F67-510A-4ED8-BACA-2B0CE8CEBC02}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F3631F67-510A-4ED8-BACA-2B0CE8CEBC02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F3631F67-510A-4ED8-BACA-2B0CE8CEBC02}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F3631F67-510A-4ED8-BACA-2B0CE8CEBC02}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F3631F67-510A-4ED8-BACA-2B0CE8CEBC02}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/ClientSimpleTcp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | //using System.Threading.Tasks;
6 |
7 | using System.Net.Sockets;
8 | using System.IO;
9 | using System.Net;
10 |
11 | namespace ChatClient1
12 | {
13 | public class ClientSimpleTcp
14 | {
15 | public Socket Sock = null;
16 | public string LatestErrorMsg;
17 | byte[] ReadBuffer = new byte[4096];
18 |
19 |
20 |
21 | //소켓연결
22 | public bool Connect(string ip, int port)
23 | {
24 | try
25 | {
26 | IPAddress serverIP = IPAddress.Parse(ip);
27 | int serverPort = port;
28 |
29 | Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
30 | Sock.Connect(new IPEndPoint(serverIP, serverPort));
31 |
32 | if (Sock == null || Sock.Connected == false)
33 | {
34 | return false;
35 | }
36 |
37 | return true;
38 | }
39 | catch (Exception ex)
40 | {
41 | LatestErrorMsg = ex.Message;
42 | return false;
43 | }
44 | }
45 |
46 | public ArraySegment Receive()
47 | {
48 | try
49 | {
50 | var nRecv = Sock.Receive(ReadBuffer, 0, ReadBuffer.Length, SocketFlags.None);
51 |
52 | if (nRecv == 0)
53 | {
54 | return new ArraySegment();
55 | }
56 |
57 | return new ArraySegment(ReadBuffer, 0, nRecv);
58 | }
59 | catch (SocketException se)
60 | {
61 | LatestErrorMsg = se.Message;
62 | }
63 |
64 | return new ArraySegment();
65 | }
66 |
67 | //스트림에 쓰기
68 | public void Send(byte[] sendData)
69 | {
70 | try
71 | {
72 | if (Sock != null && Sock.Connected) //연결상태 유무 확인
73 | {
74 | Sock.Send(sendData, 0, sendData.Length, SocketFlags.None);
75 | }
76 | else
77 | {
78 | LatestErrorMsg = "먼저 채팅서버에 접속하세요!";
79 | }
80 | }
81 | catch (SocketException se)
82 | {
83 | LatestErrorMsg = se.Message;
84 | }
85 | }
86 |
87 | //소켓과 스트림 닫기
88 | public void Close()
89 | {
90 | if (Sock != null && Sock.Connected)
91 | {
92 | Sock.Shutdown(SocketShutdown.Both);
93 | Sock.Close();
94 | }
95 | }
96 |
97 | public bool IsConnected() { return (Sock != null && Sock.Connected) ? true : false; }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/DevLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using System.Runtime.CompilerServices;
8 | using System.Threading;
9 |
10 | namespace ChatClient1
11 | {
12 | public class DevLog
13 | {
14 | static System.Collections.Concurrent.ConcurrentQueue logMsgQueue = new System.Collections.Concurrent.ConcurrentQueue();
15 |
16 | static Int64 출력가능_로그레벨 = (Int64)LOG_LEVEL.TRACE;
17 |
18 |
19 |
20 | static public void Init(LOG_LEVEL logLevel)
21 | {
22 | ChangeLogLevel(logLevel);
23 | }
24 |
25 | static public void ChangeLogLevel(LOG_LEVEL logLevel)
26 | {
27 | Interlocked.Exchange(ref 출력가능_로그레벨, (int)logLevel);
28 | }
29 |
30 | public static LOG_LEVEL CurrentLogLevel()
31 | {
32 | var curLogLevel = (LOG_LEVEL)Interlocked.Read(ref 출력가능_로그레벨);
33 | return curLogLevel;
34 | }
35 |
36 | static public void Write(string msg, LOG_LEVEL logLevel = LOG_LEVEL.TRACE,
37 | [CallerFilePath] string fileName = "",
38 | [CallerMemberName] string methodName = "",
39 | [CallerLineNumber] int lineNumber = 0)
40 | {
41 | if (CurrentLogLevel() <= logLevel)
42 | {
43 | logMsgQueue.Enqueue(string.Format("{0}:{1}| {2}", DateTime.Now, methodName, msg));
44 | }
45 | }
46 |
47 | static public bool GetLog(out string msg)
48 | {
49 | if (logMsgQueue.TryDequeue(out msg))
50 | {
51 | return true;
52 | }
53 |
54 | return false;
55 | }
56 |
57 | }
58 |
59 |
60 | public enum LOG_LEVEL
61 | {
62 | TRACE,
63 | DEBUG,
64 | INFO,
65 | WARN,
66 | ERROR,
67 | DISABLE
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/PacketBufferManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ChatClient1
8 | {
9 | public class PacketBufferManager
10 | {
11 | int BufferSize = 0;
12 | int ReadPos = 0;
13 | int WritePos = 0;
14 |
15 | int HeaderSize = 0;
16 | int MaxPacketSize = 0;
17 | byte[] PacketData;
18 | byte[] PacketDataTemp;
19 |
20 | public bool Init(int size, int headerSize, int maxPacketSize)
21 | {
22 | if (size < (maxPacketSize * 2) || size < 1 || headerSize < 1 || maxPacketSize < 1)
23 | {
24 | return false;
25 | }
26 |
27 | BufferSize = size;
28 | PacketData = new byte[size];
29 | PacketDataTemp = new byte[size];
30 | HeaderSize = headerSize;
31 | MaxPacketSize = maxPacketSize;
32 |
33 | return true;
34 | }
35 |
36 | public bool Write(byte[] data, int pos, int size)
37 | {
38 | if (data == null || (data.Length < (pos + size)))
39 | {
40 | return false;
41 | }
42 |
43 | var remainBufferSize = BufferSize - WritePos;
44 |
45 | if (remainBufferSize < size)
46 | {
47 | return false;
48 | }
49 |
50 | Buffer.BlockCopy(data, pos, PacketData, WritePos, size);
51 | WritePos += size;
52 |
53 | if (NextFree() == false)
54 | {
55 | BufferRelocate();
56 | }
57 |
58 | return true;
59 | }
60 |
61 | public ArraySegment Read()
62 | {
63 | var enableReadSize = WritePos - ReadPos;
64 |
65 | if (enableReadSize < HeaderSize)
66 | {
67 | return new ArraySegment();
68 | }
69 |
70 | var bodySize = BitConverter.ToUInt16(PacketData, (ReadPos+10));
71 | var packetDataSize = HeaderSize + bodySize;
72 |
73 | if (enableReadSize < packetDataSize)
74 | {
75 | return new ArraySegment();
76 | }
77 |
78 | var completePacketData = new ArraySegment(PacketData, ReadPos, packetDataSize);
79 | ReadPos += packetDataSize;
80 |
81 | return completePacketData;
82 | }
83 |
84 | bool NextFree()
85 | {
86 | var enableWriteSize = BufferSize - WritePos;
87 |
88 | if (enableWriteSize < MaxPacketSize)
89 | {
90 | return false;
91 | }
92 |
93 | return true;
94 | }
95 |
96 | void BufferRelocate()
97 | {
98 | var enableReadSize = WritePos - ReadPos;
99 |
100 | Buffer.BlockCopy(PacketData, ReadPos, PacketDataTemp, 0, enableReadSize);
101 | Buffer.BlockCopy(PacketDataTemp, 0, PacketData, 0, enableReadSize);
102 |
103 | ReadPos = 0;
104 | WritePos = enableReadSize;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/PacketDefine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ChatClient1
8 | {
9 | enum PACKET_ID : ushort
10 | {
11 | SYSTEM_DISCONNECTD = 12,
12 |
13 | REQUEST_LOGIN = 1001,
14 | RESPONSE_LOGIN = 1002,
15 |
16 | REQUEST_ENTER_LOBBY = 1011,
17 | RESPONSE_ENTER_LOBBY = 1012,
18 |
19 | REQUEST_LEAVE_LOBBY = 1021,
20 | RESPONSE_LEAVE_LOBBY = 1022,
21 |
22 | REQUEST_CHAT = 1031,
23 | NOTICE_CHAT = 1032,
24 | }
25 |
26 | enum ERROR_CODE : ushort
27 | {
28 | NONE = 0,
29 |
30 | ERROR = 1001,
31 |
32 | ADD_USER_DUPLICATION_SESSION = 10001,
33 | ADD_USER_DUPLICATION_ID = 10002,
34 |
35 | ENTER_LOBBY_ALREADY_LOBBY = 10011,
36 | ENTER_LOBBY_INVALID_LOBBY_ID = 10012,
37 | ENTER_LOBBY_LOBBY_FULL = 10013,
38 |
39 | LEAVE_LOBBY_DO_NOT_ENTER_LOBBY = 10021,
40 | LEAVE_LOBBY_NO_LOBBY = 10022,
41 |
42 | LOBBY_CHAT_DO_NOT_ENTER_LOBBY = 10031,
43 | }
44 |
45 | #pragma warning disable 649
46 | struct JsonPacketRequestLogin
47 | {
48 | public string ID;
49 | }
50 |
51 | struct JsonPacketResponseLogin
52 | {
53 | public ERROR_CODE Result;
54 | }
55 |
56 |
57 | struct JsonPacketRequestEnterLobby
58 | {
59 | public short LobbyID;
60 | }
61 |
62 | struct JsonPacketResponseEnterLobby
63 | {
64 | public ERROR_CODE Result;
65 | public short LobbyID;
66 | }
67 |
68 |
69 | struct JsonPacketRequestLeaveLobby
70 | {
71 | public short LobbyID;
72 | }
73 |
74 | struct JsonPacketResponseLeaveLobby
75 | {
76 | public ERROR_CODE Result;
77 | }
78 |
79 |
80 | struct JsonPacketRequestChat
81 | {
82 | public string Chat;
83 | }
84 |
85 | struct JsonPacketNoticeChat
86 | {
87 | public ERROR_CODE Result;
88 | public string UserID;
89 | public string Chat;
90 | }
91 | #pragma warning restore 649
92 | }
93 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace ChatClient1
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 해당 응용 프로그램의 주 진입점입니다.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
6 | // 어셈블리와 관련된 정보를 수정하려면
7 | // 이 특성 값을 변경하십시오.
8 | [assembly: AssemblyTitle("ChatClientNET")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ChatClientNET")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("ccedc7de-670d-48cb-a9be-0bb89fcf4438")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 이 코드는 도구를 사용하여 생성되었습니다.
4 | // 런타임 버전:4.0.30319.18444
5 | //
6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7 | // 이러한 변경 내용이 손실됩니다.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ChatClient1.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
17 | ///
18 | // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
19 | // 클래스에서 자동으로 생성되었습니다.
20 | // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
21 | // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChatClient1.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대한 현재 스레드의 CurrentUICulture
51 | /// 속성을 재정의합니다.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 이 코드는 도구를 사용하여 생성되었습니다.
4 | // 런타임 버전:4.0.30319.18444
5 | //
6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7 | // 이러한 변경 내용이 손실됩니다.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ChatClient1.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/Csharp_Client/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/POCO_Net_Samples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Global
7 | GlobalSection(SolutionProperties) = preSolution
8 | HideSolutionNode = FALSE
9 | EndGlobalSection
10 | EndGlobal
11 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_client/block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/block_echo_client/block_echo_client.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_client/block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_client", "block_echo_client.vcxproj", "{5A2784AB-5A3D-43ED-BC74-37906EC2086B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.ActiveCfg = Debug|x64
17 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.Build.0 = Debug|x64
18 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.Build.0 = Debug|Win32
20 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.ActiveCfg = Release|x64
21 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.Build.0 = Release|x64
22 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.ActiveCfg = Release|Win32
23 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_client/block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server/block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/block_echo_server/block_echo_server.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server/block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_server", "block_echo_server.vcxproj", "{298BED35-EBB3-4655-B7D0-5D1EFB119251}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.ActiveCfg = Debug|x64
17 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.Build.0 = Debug|x64
18 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.ActiveCfg = Debug|Win32
19 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.Build.0 = Debug|Win32
20 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.ActiveCfg = Release|x64
21 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.Build.0 = Release|x64
22 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.ActiveCfg = Release|Win32
23 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server/block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server_MD/block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/block_echo_server_MD/block_echo_server.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server_MD/block_echo_server_MD.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_server_MD", "block_echo_server_MD.vcxproj", "{94B5B621-CA27-4E00-B012-FD8B2B78C2CA}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Debug|x64.ActiveCfg = Debug|x64
17 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Debug|x64.Build.0 = Debug|x64
18 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Debug|x86.ActiveCfg = Debug|Win32
19 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Debug|x86.Build.0 = Debug|Win32
20 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Release|x64.ActiveCfg = Release|x64
21 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Release|x64.Build.0 = Release|x64
22 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Release|x86.ActiveCfg = Release|Win32
23 | {94B5B621-CA27-4E00-B012-FD8B2B78C2CA}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_server_MD/block_echo_server_MD.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_client/udp_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/block_echo_udp_client/udp_client.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_client/udp_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp_client", "udp_client.vcxproj", "{E2C85060-5423-4F39-BD25-1D41CC8CFF7F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x64.ActiveCfg = Debug|x64
17 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x64.Build.0 = Debug|x64
18 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x86.Build.0 = Debug|Win32
20 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x64.ActiveCfg = Release|x64
21 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x64.Build.0 = Release|x64
22 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x86.ActiveCfg = Release|Win32
23 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_client/udp_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_server/udp_server.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 |
7 | const Poco::UInt16 MY_PORT = 32452;
8 |
9 |
10 | int main()
11 | {
12 | Poco::Net::DatagramSocket serv_sock(MY_PORT);
13 | Poco::Net::SocketAddress client;
14 |
15 | while (true)
16 | {
17 | try
18 | {
19 | char buffer[256] = { 0, };
20 | Poco::Net::SocketAddress sender;
21 | int len = serv_sock.receiveFrom(buffer, sizeof(buffer), sender);
22 |
23 | if (len > 0)
24 | {
25 | std::cout << buffer << " from " << sender.host().toString() << ":" << sender.port() << std::endl;
26 |
27 |
28 | char szSendMessage[256] = { 0, };
29 | sprintf_s(szSendMessage, 256 - 1, "Re:%s", buffer);
30 | int nMsgLen = (int)strnlen_s(szSendMessage, 256 - 1);
31 |
32 | serv_sock.sendTo(szSendMessage, nMsgLen, sender);
33 | }
34 | }
35 | catch (Poco::Exception& exc)
36 | {
37 | std::cerr << "UDPEchoServer: " << exc.displayText() << std::endl;
38 | }
39 | }
40 |
41 | return(0);
42 | }
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_server/udp_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp_server", "udp_server.vcxproj", "{59020818-4B4C-4EB1-9152-E47D3B013FE1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x64.ActiveCfg = Debug|x64
17 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x64.Build.0 = Debug|x64
18 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x86.ActiveCfg = Debug|Win32
19 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x86.Build.0 = Debug|Win32
20 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x64.ActiveCfg = Release|x64
21 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x64.Build.0 = Release|x64
22 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x86.ActiveCfg = Release|Win32
23 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/block_echo_udp_server/udp_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/config_TCPServer/config_TCPServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/config_TCPServer/config_TCPServer.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/config_TCPServer/config_TCPServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config_TCPServer", "config_TCPServer.vcxproj", "{1C03C08B-897B-4670-9847-729D56A3EFAD}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Debug|x64.ActiveCfg = Debug|x64
17 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Debug|x64.Build.0 = Debug|x64
18 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Debug|x86.ActiveCfg = Debug|Win32
19 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Debug|x86.Build.0 = Debug|Win32
20 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Release|x64.ActiveCfg = Release|x64
21 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Release|x64.Build.0 = Release|x64
22 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Release|x86.ActiveCfg = Release|Win32
23 | {1C03C08B-897B-4670-9847-729D56A3EFAD}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/config_TCPServer/config_TCPServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/ClientSimpleTcp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Sockets;
3 | using System.Net;
4 |
5 | namespace csharp_test_client
6 | {
7 | public class ClientSimpleTcp
8 | {
9 | public Socket Sock = null;
10 | public string LatestErrorMsg;
11 |
12 |
13 | //소켓연결
14 | public bool Connect(string ip, int port)
15 | {
16 | try
17 | {
18 | IPAddress serverIP = IPAddress.Parse(ip);
19 | int serverPort = port;
20 |
21 | Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
22 | Sock.Connect(new IPEndPoint(serverIP, serverPort));
23 |
24 | if (Sock == null || Sock.Connected == false)
25 | {
26 | return false;
27 | }
28 |
29 | return true;
30 | }
31 | catch (Exception ex)
32 | {
33 | LatestErrorMsg = ex.Message;
34 | return false;
35 | }
36 | }
37 |
38 | public Tuple Receive()
39 | {
40 |
41 | try
42 | {
43 | byte[] ReadBuffer = new byte[2048];
44 | var nRecv = Sock.Receive(ReadBuffer, 0, ReadBuffer.Length, SocketFlags.None);
45 |
46 | if (nRecv == 0)
47 | {
48 | return null;
49 | }
50 |
51 | return Tuple.Create(nRecv,ReadBuffer);
52 | }
53 | catch (SocketException se)
54 | {
55 | LatestErrorMsg = se.Message;
56 | }
57 |
58 | return null;
59 | }
60 |
61 | //스트림에 쓰기
62 | public void Send(byte[] sendData)
63 | {
64 | try
65 | {
66 | if (Sock != null && Sock.Connected) //연결상태 유무 확인
67 | {
68 | Sock.Send(sendData, 0, sendData.Length, SocketFlags.None);
69 | }
70 | else
71 | {
72 | LatestErrorMsg = "먼저 채팅서버에 접속하세요!";
73 | }
74 | }
75 | catch (SocketException se)
76 | {
77 | LatestErrorMsg = se.Message;
78 | }
79 | }
80 |
81 | //소켓과 스트림 닫기
82 | public void Close()
83 | {
84 | if (Sock != null && Sock.Connected)
85 | {
86 | Sock.Shutdown(SocketShutdown.Both);
87 | Sock.Close();
88 | }
89 | }
90 |
91 | public bool IsConnected() { return (Sock != null && Sock.Connected) ? true : false; }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/DevLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using System.Runtime.CompilerServices;
8 | using System.Threading;
9 |
10 | namespace csharp_test_client
11 | {
12 | public class DevLog
13 | {
14 | static System.Collections.Concurrent.ConcurrentQueue logMsgQueue = new System.Collections.Concurrent.ConcurrentQueue();
15 |
16 | static Int64 출력가능_로그레벨 = (Int64)LOG_LEVEL.TRACE;
17 |
18 |
19 |
20 | static public void Init(LOG_LEVEL logLevel)
21 | {
22 | ChangeLogLevel(logLevel);
23 | }
24 |
25 | static public void ChangeLogLevel(LOG_LEVEL logLevel)
26 | {
27 | Interlocked.Exchange(ref 출력가능_로그레벨, (int)logLevel);
28 | }
29 |
30 | public static LOG_LEVEL CurrentLogLevel()
31 | {
32 | var curLogLevel = (LOG_LEVEL)Interlocked.Read(ref 출력가능_로그레벨);
33 | return curLogLevel;
34 | }
35 |
36 | static public void Write(string msg, LOG_LEVEL logLevel = LOG_LEVEL.TRACE,
37 | [CallerFilePath] string fileName = "",
38 | [CallerMemberName] string methodName = "",
39 | [CallerLineNumber] int lineNumber = 0)
40 | {
41 | if (CurrentLogLevel() <= logLevel)
42 | {
43 | logMsgQueue.Enqueue(string.Format("{0}:{1}| {2}", DateTime.Now, methodName, msg));
44 | }
45 | }
46 |
47 | static public bool GetLog(out string msg)
48 | {
49 | if (logMsgQueue.TryDequeue(out msg))
50 | {
51 | return true;
52 | }
53 |
54 | return false;
55 | }
56 |
57 | }
58 |
59 |
60 | public enum LOG_LEVEL
61 | {
62 | TRACE,
63 | DEBUG,
64 | INFO,
65 | WARN,
66 | ERROR,
67 | DISABLE
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace csharp_test_client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 해당 응용 프로그램의 주 진입점입니다.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new mainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
6 | // 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
7 | // 이러한 특성 값을 변경하세요.
8 | [assembly: AssemblyTitle("csharp_test_client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("csharp_test_client")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("9e4b5e72-4e76-4e22-90b0-e53275a99018")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 이 코드는 도구를 사용하여 생성되었습니다.
4 | // 런타임 버전:4.0.30319.42000
5 | //
6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7 | // 이러한 변경 내용이 손실됩니다.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
17 | ///
18 | // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
19 | // 클래스에서 자동으로 생성되었습니다.
20 | // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
21 | // ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("csharp_test_client.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해
56 | /// 현재 스레드의 CurrentUICulture 속성을 재정의합니다.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/csharp_test_client/csharp_test_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_test_client", "csharp_test_client.csproj", "{9E4B5E72-4E76-4E22-90B0-E53275A99018}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_client/SimpleHttpGetter.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | class SimpleHttpGetter
10 | {
11 | public:
12 | SimpleHttpGetter(const std::string& host, Poco::UInt16 port = Poco::Net::HTTPSession::HTTP_PORT) : mHost(host), mPort(port)
13 | {
14 | }
15 |
16 | ~SimpleHttpGetter()
17 | {
18 | }
19 |
20 | int Get(const std::string& path, std::ostream& ostr)
21 | {
22 | try
23 | {
24 | const std::string myPath = ('/' == path.c_str()[0]) ? path:("/"+path);
25 |
26 | Poco::Net::HTTPClientSession session(mHost, mPort);
27 | Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_GET, path, Poco::Net::HTTPMessage::HTTP_1_1);
28 | session.sendRequest(req);
29 | Poco::Net::HTTPResponse res;
30 | std::istream& rs = session.receiveResponse(res);
31 | Poco::StreamCopier::copyStream(rs, ostr);
32 | }
33 | catch (Poco::Exception& exc)
34 | {
35 | return -1;
36 | }
37 |
38 | return 0;
39 | }
40 |
41 | private:
42 | SimpleHttpGetter();
43 | SimpleHttpGetter(const SimpleHttpGetter&);
44 | SimpleHttpGetter& operator = (const SimpleHttpGetter&);
45 |
46 | std::string mHost;
47 | Poco::UInt16 mPort;
48 | };
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_client/SimpleHttpPoster.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 |
14 | class SimpleHttpPoster
15 | {
16 | public:
17 | SimpleHttpPoster() { }
18 | ~SimpleHttpPoster() {}
19 |
20 | bool Start(const std::string& url, int reqCount)
21 | {
22 | for(auto i = 0; i < reqCount; ++i)
23 | {
24 | Poco::URI uri(url);
25 | std::string resultPacket;
26 |
27 | if(Post(uri, resultPacket) == -1)
28 | {
29 | return false;
30 | }
31 |
32 | //std::cout << resultPacket << std::endl;
33 | }
34 |
35 | return true;
36 | }
37 |
38 |
39 | private:
40 | int Post(Poco::URI& uri, std::string& resultBuffer)
41 | {
42 | try
43 | {
44 | std::string path = uri.getPath();
45 | const std::string myPath = ('/' == uri.getPath().c_str()[0]) ? uri.getPath():("/"+path);
46 |
47 | Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_POST, uri.getPath(), Poco::Net::HTTPMessage::HTTP_1_1);
48 |
49 | req.setContentType("application/x-www-form-urlencoded");
50 | Poco::Net::HTMLForm form;
51 | form.add("userName", "hello");
52 | form.add("password", "123456");
53 | form.prepareSubmit(req);
54 |
55 | Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
56 | std::ostream& ostr = session.sendRequest(req);
57 | form.write(ostr);
58 |
59 |
60 | Poco::Net::HTTPResponse res;
61 | std::istream& is = session.receiveResponse(res);
62 |
63 | std::streamsize _size = Poco::StreamCopier::copyToString( is, resultBuffer );
64 | return (int)_size;
65 | }
66 | catch (Poco::Exception& exc)
67 | {
68 | return -1;
69 | }
70 |
71 | return 0;
72 | }
73 |
74 |
75 | std::string mHost;
76 | Poco::UInt16 mPort;
77 | };
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_client/http_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_client", "http_client.vcxproj", "{426CE2BF-FA5A-465E-AA63-D2A48946C58B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.ActiveCfg = Debug|x64
17 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.Build.0 = Debug|x64
18 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.Build.0 = Debug|Win32
20 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.ActiveCfg = Release|x64
21 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.Build.0 = Release|x64
22 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.ActiveCfg = Release|Win32
23 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_client/http_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_client/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "SimpleHttpGetter.h"
5 | #include "SimpleHttpPoster.h"
6 |
7 |
8 | int main()
9 | {
10 | /*Poco::URI uri("http://poco.roundsquare.net/downloads/test.txt");
11 | {
12 | SimpleHTTPGetter getter(uri.getHost(), uri.getPort());
13 | getter.Get(uri.getPath(), std::cout);
14 | }*/
15 |
16 | SimpleHttpPoster poster;
17 | auto result = poster.Start("http://localhost:20401/Service/TestRequestStream", 1000);
18 | std::cout << result << std::endl;
19 |
20 | return 0;
21 | }
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_server/http_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/http_server/http_server.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_server/http_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_server", "http_server.vcxproj", "{748C3C06-4626-461C-BE35-B685F773EA57}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.ActiveCfg = Debug|x64
17 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.Build.0 = Debug|x64
18 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.ActiveCfg = Debug|Win32
19 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.Build.0 = Debug|Win32
20 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.ActiveCfg = Release|x64
21 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.Build.0 = Release|x64
22 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.ActiveCfg = Release|Win32
23 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/http_server/http_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/ini_reader/ini_reader.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ini_reader", "ini_reader.vcxproj", "{3236DA02-3958-467D-B051-23523BA749AD}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3236DA02-3958-467D-B051-23523BA749AD}.Debug|x64.ActiveCfg = Debug|x64
17 | {3236DA02-3958-467D-B051-23523BA749AD}.Debug|x64.Build.0 = Debug|x64
18 | {3236DA02-3958-467D-B051-23523BA749AD}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3236DA02-3958-467D-B051-23523BA749AD}.Debug|x86.Build.0 = Debug|Win32
20 | {3236DA02-3958-467D-B051-23523BA749AD}.Release|x64.ActiveCfg = Release|x64
21 | {3236DA02-3958-467D-B051-23523BA749AD}.Release|x64.Build.0 = Release|x64
22 | {3236DA02-3958-467D-B051-23523BA749AD}.Release|x86.ActiveCfg = Release|Win32
23 | {3236DA02-3958-467D-B051-23523BA749AD}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/ini_reader/ini_reader.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/ini_reader/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/ini_reader/main.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/ini_reader/test.ini:
--------------------------------------------------------------------------------
1 | [ZoneServer]
2 | CHANNEL_COUNT = 10
3 | CHANNEL_USER_COUNT = 200
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_client/multi_session_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/multi_session_client/multi_session_client.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_client/multi_session_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_session_client", "multi_session_client.vcxproj", "{98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Debug|x64.ActiveCfg = Debug|x64
17 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Debug|x64.Build.0 = Debug|x64
18 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Debug|x86.Build.0 = Debug|Win32
20 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Release|x64.ActiveCfg = Release|x64
21 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Release|x64.Build.0 = Release|x64
22 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Release|x86.ActiveCfg = Release|Win32
23 | {98B8ABA1-7B8A-440A-9C04-872AA8BBC69B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_client/multi_session_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_server/multi_session_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/multi_session_server/multi_session_server.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_server/multi_session_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_session_server", "multi_session_server.vcxproj", "{E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Debug|x64.ActiveCfg = Debug|x64
17 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Debug|x64.Build.0 = Debug|x64
18 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Debug|x86.ActiveCfg = Debug|Win32
19 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Debug|x86.Build.0 = Debug|Win32
20 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Release|x64.ActiveCfg = Release|x64
21 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Release|x64.Build.0 = Release|x64
22 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Release|x86.ActiveCfg = Release|Win32
23 | {E0C3AC6D-D0CE-4F55-B7B6-139A469BD770}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/multi_session_server/multi_session_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/name_resolution/name_resolution.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/name_resolution/name_resolution.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/name_resolution/name_resolution.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "name_resolution", "name_resolution.vcxproj", "{CA247D66-365F-4591-9FE2-6F03DBC77210}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Debug|x64.ActiveCfg = Debug|x64
17 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Debug|x64.Build.0 = Debug|x64
18 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Debug|x86.ActiveCfg = Debug|Win32
19 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Debug|x86.Build.0 = Debug|Win32
20 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Release|x64.ActiveCfg = Release|x64
21 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Release|x64.Build.0 = Release|x64
22 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Release|x86.ActiveCfg = Release|Win32
23 | {CA247D66-365F-4591-9FE2-6F03DBC77210}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/name_resolution/name_resolution.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/network_interfaceList/network_interfaceList.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/network_interfaceList/network_interfaceList.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/network_interfaceList/network_interfaceList.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "network_interfaceList", "network_interfaceList.vcxproj", "{39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Debug|x64.ActiveCfg = Debug|x64
17 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Debug|x64.Build.0 = Debug|x64
18 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Debug|x86.ActiveCfg = Debug|Win32
19 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Debug|x86.Build.0 = Debug|Win32
20 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Release|x64.ActiveCfg = Release|x64
21 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Release|x64.Build.0 = Release|x64
22 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Release|x86.ActiveCfg = Release|Win32
23 | {39CCDDDC-745B-4D25-AD5D-1AF7E0C25F93}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/network_interfaceList/network_interfaceList.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_client/non-block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/non-block_echo_client/non-block_echo_client.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_client/non-block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_client", "non-block_echo_client.vcxproj", "{C37579F2-ECAA-47A1-A07A-6A5F37265F76}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.ActiveCfg = Debug|x64
17 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.Build.0 = Debug|x64
18 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.ActiveCfg = Debug|Win32
19 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.Build.0 = Debug|Win32
20 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.ActiveCfg = Release|x64
21 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.Build.0 = Release|x64
22 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.ActiveCfg = Release|Win32
23 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_client/non-block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_server/non-block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/non-block_echo_server/non-block_echo_server.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_server/non-block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_server", "non-block_echo_server.vcxproj", "{4D678968-F02A-41F8-AC29-67B8A8FDE54F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.ActiveCfg = Debug|x64
17 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.Build.0 = Debug|x64
18 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.Build.0 = Debug|Win32
20 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.ActiveCfg = Release|x64
21 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.Build.0 = Release|x64
22 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.ActiveCfg = Release|Win32
23 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/non-block_echo_server/non-block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/parallelreactor_EchoServer/parallelreactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/parallelreactor_EchoServer/parallelreactor_EchoServer.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/parallelreactor_EchoServer/parallelreactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallelreactor_EchoServer", "parallelreactor_EchoServer.vcxproj", "{8ACA22DB-5483-4B0A-8B2A-E184C085483B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.ActiveCfg = Debug|x64
17 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.Build.0 = Debug|x64
18 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.Build.0 = Debug|Win32
20 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.ActiveCfg = Release|x64
21 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.Build.0 = Release|x64
22 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.ActiveCfg = Release|Win32
23 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/parallelreactor_EchoServer/parallelreactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EchoServer/reactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/reactor_EchoServer/reactor_EchoServer.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EchoServer/reactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EchoServer", "reactor_EchoServer.vcxproj", "{06B4D279-3571-412F-9838-5B8F1106F22B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.ActiveCfg = Debug|x64
17 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.Build.0 = Debug|x64
18 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.Build.0 = Debug|Win32
20 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.ActiveCfg = Release|x64
21 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.Build.0 = Release|x64
22 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.ActiveCfg = Release|Win32
23 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EchoServer/reactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EcohoServerEx/reactor_EcohoServerEx.properties:
--------------------------------------------------------------------------------
1 | # This is a sample configuration file
2 |
3 | EchoServer.port = 32452
4 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EcohoServerEx/reactor_EcohoServerEx.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EcohoServerEx", "reactor_EcohoServerEx.vcxproj", "{36C9E62D-01FA-4104-8140-8490CD245D58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.ActiveCfg = Debug|x64
17 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.Build.0 = Debug|x64
18 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.ActiveCfg = Debug|Win32
19 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.Build.0 = Debug|Win32
20 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.ActiveCfg = Release|x64
21 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.Build.0 = Release|x64
22 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.ActiveCfg = Release|Win32
23 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/reactor_EcohoServerEx/reactor_EcohoServerEx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/simple_TCPServer/simple_TCPServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/simple_TCPServer/simple_TCPServer.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/simple_TCPServer/simple_TCPServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_TCPServer", "simple_TCPServer.vcxproj", "{3FE81E07-88CD-48AD-A766-849407759BA4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.ActiveCfg = Debug|x64
17 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.Build.0 = Debug|x64
18 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.Build.0 = Debug|Win32
20 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.ActiveCfg = Release|x64
21 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.Build.0 = Release|x64
22 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.ActiveCfg = Release|Win32
23 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/simple_TCPServer/simple_TCPServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/socketConnector_client/socketConnector_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/POCO_Net_Samples/socketConnector_client/socketConnector_client.cpp
--------------------------------------------------------------------------------
/POCO_Net_Samples/socketConnector_client/socketConnector_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "socketConnector_client", "socketConnector_client.vcxproj", "{7615B379-7F8F-406E-BDAC-CEDB48C37739}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.ActiveCfg = Debug|x64
17 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.Build.0 = Debug|x64
18 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.ActiveCfg = Debug|Win32
19 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.Build.0 = Debug|Win32
20 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.ActiveCfg = Release|x64
21 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.Build.0 = Release|x64
22 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.ActiveCfg = Release|Win32
23 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/socketConnector_client/socketConnector_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/tcpserver_EchoServerEx/tcpserver_EchoServerEx.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcpserver_EchoServerEx", "tcpserver_EchoServerEx.vcxproj", "{03BA4A30-DCB5-4301-A70A-28E6D1063D4F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Debug|x64.ActiveCfg = Debug|x64
17 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Debug|x64.Build.0 = Debug|x64
18 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Debug|x86.Build.0 = Debug|Win32
20 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Release|x64.ActiveCfg = Release|x64
21 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Release|x64.Build.0 = Release|x64
22 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Release|x86.ActiveCfg = Release|Win32
23 | {03BA4A30-DCB5-4301-A70A-28E6D1063D4F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/POCO_Net_Samples/tcpserver_EchoServerEx/tcpserver_EchoServerEx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## POCO 이용한 네트워크 프로그래밍 예제
2 |
3 | 한빛미디어 출판
4 | [구매하기](http://www.hanbit.co.kr/realtime/books/book_view.html?p_code=E2635062247)
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_client/block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/01_block_echo_client/block_echo_client.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_client/block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_client", "block_echo_client.vcxproj", "{5A2784AB-5A3D-43ED-BC74-37906EC2086B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.ActiveCfg = Debug|x64
17 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.Build.0 = Debug|x64
18 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.Build.0 = Debug|Win32
20 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.ActiveCfg = Release|x64
21 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.Build.0 = Release|x64
22 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.ActiveCfg = Release|Win32
23 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_client/block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_server/block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/01_block_echo_server/block_echo_server.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_server/block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_server", "block_echo_server.vcxproj", "{298BED35-EBB3-4655-B7D0-5D1EFB119251}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.ActiveCfg = Debug|x64
17 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.Build.0 = Debug|x64
18 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.ActiveCfg = Debug|Win32
19 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.Build.0 = Debug|Win32
20 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.ActiveCfg = Release|x64
21 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.Build.0 = Release|x64
22 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.ActiveCfg = Release|Win32
23 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/01_block_echo_server/block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_client/non-block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/02_non-block_echo_client/non-block_echo_client.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_client/non-block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_client", "non-block_echo_client.vcxproj", "{C37579F2-ECAA-47A1-A07A-6A5F37265F76}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.ActiveCfg = Debug|x64
17 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.Build.0 = Debug|x64
18 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.ActiveCfg = Debug|Win32
19 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.Build.0 = Debug|Win32
20 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.ActiveCfg = Release|x64
21 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.Build.0 = Release|x64
22 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.ActiveCfg = Release|Win32
23 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_client/non-block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_server/non-block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/02_non-block_echo_server/non-block_echo_server.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_server/non-block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_server", "non-block_echo_server.vcxproj", "{4D678968-F02A-41F8-AC29-67B8A8FDE54F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.ActiveCfg = Debug|x64
17 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.Build.0 = Debug|x64
18 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.Build.0 = Debug|Win32
20 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.ActiveCfg = Release|x64
21 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.Build.0 = Release|x64
22 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.ActiveCfg = Release|Win32
23 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/02_non-block_echo_server/non-block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoClient/reactor_EchoClient.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/03_reactor_EchoClient/reactor_EchoClient.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoClient/reactor_EchoClient.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoClient/reactor_EchoClient.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EchoClient", "reactor_EchoClient.vcxproj", "{7615B379-7F8F-406E-BDAC-CEDB48C37739}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.ActiveCfg = Debug|x64
17 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.Build.0 = Debug|x64
18 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.ActiveCfg = Debug|Win32
19 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.Build.0 = Debug|Win32
20 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.ActiveCfg = Release|x64
21 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.Build.0 = Release|x64
22 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.ActiveCfg = Release|Win32
23 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoServer/reactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/03_reactor_EchoServer/reactor_EchoServer.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoServer/reactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EchoServer", "reactor_EchoServer.vcxproj", "{06B4D279-3571-412F-9838-5B8F1106F22B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.ActiveCfg = Debug|x64
17 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.Build.0 = Debug|x64
18 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.Build.0 = Debug|Win32
20 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.ActiveCfg = Release|x64
21 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.Build.0 = Release|x64
22 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.ActiveCfg = Release|Win32
23 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/03_reactor_EchoServer/reactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/04_reactor_EcohoServerEx/reactor_EcohoServerEx.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define POCO_STATIC
4 | #include
5 | #include
6 |
7 |
8 | const Poco::UInt16 PORT = 32452;
9 |
10 |
11 | class Session {
12 | public:
13 | Session(Poco::Net::StreamSocket& socket, Poco::Net::SocketReactor& reactor) :
14 | m_Socket(socket),
15 | m_Reactor(reactor)
16 | {
17 | m_PeerAddress = socket.peerAddress().toString();
18 |
19 | std::cout << "connection from " << m_PeerAddress << " ..." << std::endl;
20 |
21 | // 데이터 읽기 가능할 때 발생하는 이벤트
22 | m_Reactor.addEventHandler(m_Socket,
23 | Poco::Observer(*this, &Session::onReadable));
24 |
25 | // SocketReactor가 셧다운 할 때 발생하는 이벤트
26 | m_Reactor.addEventHandler(m_Socket,
27 | Poco::Observer(*this, &Session::onShutdown));
28 |
29 | // 소켓에 에러가 생겼을 때 발생하는 이벤트
30 | m_Reactor.addEventHandler(m_Socket,
31 | Poco::Observer(*this, &Session::onError));
32 |
33 | // Poco::Net::select 호출 시 react 할 소켓이 없는 경우 발생하는 이벤트
34 | m_Reactor.addEventHandler(m_Socket,
35 | Poco::Observer(*this, &Session::onIdle));
36 |
37 | // Poco::Net::select 호출 후 지정 시간까지 이벤트가 없을 때 발생하는 이벤트
38 | m_Reactor.addEventHandler(m_Socket,
39 | Poco::Observer(*this, &Session::onTimeout));
40 |
41 | }
42 |
43 | ~Session()
44 | {
45 | std::cout << m_PeerAddress << " disconnected ..." << std::endl;
46 |
47 | m_Reactor.removeEventHandler(m_Socket,
48 | Poco::Observer(*this, &Session::onReadable)
49 | );
50 |
51 | m_Reactor.removeEventHandler(m_Socket,
52 | Poco::Observer(*this, &Session::onShutdown)
53 | );
54 |
55 | m_Reactor.removeEventHandler(m_Socket,
56 | Poco::Observer(*this, &Session::onError)
57 | );
58 |
59 | m_Reactor.removeEventHandler(m_Socket,
60 | Poco::Observer(*this, &Session::onIdle)
61 | );
62 |
63 | m_Reactor.removeEventHandler(m_Socket,
64 | Poco::Observer(*this, &Session::onTimeout)
65 | );
66 | }
67 |
68 | void onReadable(Poco::Net::ReadableNotification* pNf)
69 | {
70 | pNf->release();
71 |
72 | char buffer[256] = { 0, };
73 | int n = m_Socket.receiveBytes(buffer, sizeof(buffer));
74 | if (n > 0)
75 | {
76 | std::cout << "클라이언트에서 받은 메시지: " << buffer << std::endl;
77 |
78 | char szSendMessage[256] = { 0, };
79 | sprintf_s(szSendMessage, 256 - 1, "Re:%s", buffer);
80 | int nMsgLen = (int)strnlen_s(szSendMessage, 256 - 1);
81 |
82 | m_Socket.sendBytes(szSendMessage, nMsgLen);
83 | }
84 | else
85 | {
86 | m_Socket.shutdownSend();
87 | delete this;
88 | }
89 | }
90 |
91 | void onShutdown(Poco::Net::ShutdownNotification* pNf)
92 | {
93 | pNf->release();
94 |
95 | std::cout << "onShutdown 발생" << std::endl;
96 | }
97 |
98 | void onError(Poco::Net::ErrorNotification* pNf)
99 | {
100 | pNf->release();
101 |
102 | std::cout << "onError 발생" << std::endl;
103 | }
104 |
105 | void onTimeout(Poco::Net::TimeoutNotification* pNf)
106 | {
107 | pNf->release();
108 |
109 | std::cout << "onTimeout 발생" << std::endl;
110 | }
111 |
112 | void onIdle(Poco::Net::IdleNotification* pNf)
113 | {
114 | pNf->release();
115 |
116 | std::cout << "onIdle 발생" << std::endl;
117 | }
118 |
119 | private:
120 | Poco::Net::StreamSocket m_Socket;
121 | std::string m_PeerAddress;
122 | Poco::Net::SocketReactor& m_Reactor;
123 | };
124 |
125 |
126 |
127 | int main()
128 | {
129 | Poco::Timespan timeout(10, 0);
130 | Poco::Net::SocketReactor reactor(timeout);
131 |
132 | Poco::Net::ServerSocket serverSocket(PORT);
133 |
134 | Poco::Net::SocketAcceptor acceptor(serverSocket, reactor);
135 |
136 |
137 | std::cout << "Reactor: starting..." << std::endl;
138 |
139 | reactor.run();
140 |
141 |
142 | std::cout << "Reactor: 종료..." << std::endl;
143 | getchar();
144 | return 0;
145 | }
--------------------------------------------------------------------------------
/Semina_2017-09-16/04_reactor_EcohoServerEx/reactor_EcohoServerEx.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EcohoServerEx", "reactor_EcohoServerEx.vcxproj", "{36C9E62D-01FA-4104-8140-8490CD245D58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.ActiveCfg = Debug|x64
17 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.Build.0 = Debug|x64
18 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.ActiveCfg = Debug|Win32
19 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.Build.0 = Debug|Win32
20 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.ActiveCfg = Release|x64
21 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.Build.0 = Release|x64
22 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.ActiveCfg = Release|Win32
23 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/04_reactor_EcohoServerEx/reactor_EcohoServerEx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/05_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/05_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/05_parallelreactor_EchoServer/parallelreactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallelreactor_EchoServer", "parallelreactor_EchoServer.vcxproj", "{8ACA22DB-5483-4B0A-8B2A-E184C085483B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.ActiveCfg = Debug|x64
17 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.Build.0 = Debug|x64
18 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.Build.0 = Debug|Win32
20 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.ActiveCfg = Release|x64
21 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.Build.0 = Release|x64
22 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.ActiveCfg = Release|Win32
23 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/05_parallelreactor_EchoServer/parallelreactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/iniFileRead/iniFileRead.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.8
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iniFileRead", "iniFileRead.vcxproj", "{29AE68E3-B574-438A-8CD3-F61008FFA082}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Debug|x64.ActiveCfg = Debug|x64
17 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Debug|x64.Build.0 = Debug|x64
18 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Debug|x86.ActiveCfg = Debug|Win32
19 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Debug|x86.Build.0 = Debug|Win32
20 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Release|x64.ActiveCfg = Release|x64
21 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Release|x64.Build.0 = Release|x64
22 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Release|x86.ActiveCfg = Release|Win32
23 | {29AE68E3-B574-438A-8CD3-F61008FFA082}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {84A3CAD7-0E0A-4D58-8F55-C73AAA242E35}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/iniFileRead/iniFileRead.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Semina_2017-09-16/iniFileRead/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2017-09-16/iniFileRead/main.cpp
--------------------------------------------------------------------------------
/Semina_2017-09-16/iniFileRead/test.ini:
--------------------------------------------------------------------------------
1 | [ZoneServer]
2 | CHANNEL_COUNT = 10
3 | CHANNEL_USER_COUNT = 200
--------------------------------------------------------------------------------
/Semina_2021-03-17/01_block_echo_server/block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2021-03-17/01_block_echo_server/block_echo_server.cpp
--------------------------------------------------------------------------------
/Semina_2021-03-17/01_block_echo_server/block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_server", "block_echo_server.vcxproj", "{298BED35-EBB3-4655-B7D0-5D1EFB119251}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.ActiveCfg = Debug|x64
17 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.Build.0 = Debug|x64
18 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.ActiveCfg = Debug|Win32
19 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.Build.0 = Debug|Win32
20 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.ActiveCfg = Release|x64
21 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.Build.0 = Release|x64
22 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.ActiveCfg = Release|Win32
23 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/01_block_echo_server/block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/02_reactor_EcohoServerEx/reactor_EcohoServerEx.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EcohoServerEx", "reactor_EcohoServerEx.vcxproj", "{36C9E62D-01FA-4104-8140-8490CD245D58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.ActiveCfg = Debug|x64
17 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.Build.0 = Debug|x64
18 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.ActiveCfg = Debug|Win32
19 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.Build.0 = Debug|Win32
20 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.ActiveCfg = Release|x64
21 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.Build.0 = Release|x64
22 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.ActiveCfg = Release|Win32
23 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/02_reactor_EcohoServerEx/reactor_EcohoServerEx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/03_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2021-03-17/03_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp
--------------------------------------------------------------------------------
/Semina_2021-03-17/03_parallelreactor_EchoServer/parallelreactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallelreactor_EchoServer", "parallelreactor_EchoServer.vcxproj", "{8ACA22DB-5483-4B0A-8B2A-E184C085483B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.ActiveCfg = Debug|x64
17 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.Build.0 = Debug|x64
18 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.Build.0 = Debug|Win32
20 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.ActiveCfg = Release|x64
21 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.Build.0 = Release|x64
22 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.ActiveCfg = Release|Win32
23 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/03_parallelreactor_EchoServer/parallelreactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/ClientSimpleTcp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Sockets;
3 | using System.Net;
4 |
5 | namespace csharp_test_client
6 | {
7 | public class ClientSimpleTcp
8 | {
9 | public Socket Sock = null;
10 | public string LatestErrorMsg;
11 |
12 |
13 | //소켓연결
14 | public bool Connect(string ip, int port)
15 | {
16 | try
17 | {
18 | IPAddress serverIP = IPAddress.Parse(ip);
19 | int serverPort = port;
20 |
21 | Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
22 | Sock.Connect(new IPEndPoint(serverIP, serverPort));
23 |
24 | if (Sock == null || Sock.Connected == false)
25 | {
26 | return false;
27 | }
28 |
29 | return true;
30 | }
31 | catch (Exception ex)
32 | {
33 | LatestErrorMsg = ex.Message;
34 | return false;
35 | }
36 | }
37 |
38 | public Tuple Receive()
39 | {
40 |
41 | try
42 | {
43 | byte[] ReadBuffer = new byte[2048];
44 | var nRecv = Sock.Receive(ReadBuffer, 0, ReadBuffer.Length, SocketFlags.None);
45 |
46 | if (nRecv == 0)
47 | {
48 | return null;
49 | }
50 |
51 | return Tuple.Create(nRecv,ReadBuffer);
52 | }
53 | catch (SocketException se)
54 | {
55 | LatestErrorMsg = se.Message;
56 | }
57 |
58 | return null;
59 | }
60 |
61 | //스트림에 쓰기
62 | public void Send(byte[] sendData)
63 | {
64 | try
65 | {
66 | if (Sock != null && Sock.Connected) //연결상태 유무 확인
67 | {
68 | Sock.Send(sendData, 0, sendData.Length, SocketFlags.None);
69 | }
70 | else
71 | {
72 | LatestErrorMsg = "먼저 채팅서버에 접속하세요!";
73 | }
74 | }
75 | catch (SocketException se)
76 | {
77 | LatestErrorMsg = se.Message;
78 | }
79 | }
80 |
81 | //소켓과 스트림 닫기
82 | public void Close()
83 | {
84 | if (Sock != null && Sock.Connected)
85 | {
86 | //Sock.Shutdown(SocketShutdown.Both);
87 | Sock.Close();
88 | }
89 | }
90 |
91 | public bool IsConnected() { return (Sock != null && Sock.Connected) ? true : false; }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/DevLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using System.Runtime.CompilerServices;
8 | using System.Threading;
9 |
10 | namespace csharp_test_client
11 | {
12 | public class DevLog
13 | {
14 | static System.Collections.Concurrent.ConcurrentQueue logMsgQueue = new System.Collections.Concurrent.ConcurrentQueue();
15 |
16 | static Int64 출력가능_로그레벨 = (Int64)LOG_LEVEL.TRACE;
17 |
18 |
19 |
20 | static public void Init(LOG_LEVEL logLevel)
21 | {
22 | ChangeLogLevel(logLevel);
23 | }
24 |
25 | static public void ChangeLogLevel(LOG_LEVEL logLevel)
26 | {
27 | Interlocked.Exchange(ref 출력가능_로그레벨, (int)logLevel);
28 | }
29 |
30 | public static LOG_LEVEL CurrentLogLevel()
31 | {
32 | var curLogLevel = (LOG_LEVEL)Interlocked.Read(ref 출력가능_로그레벨);
33 | return curLogLevel;
34 | }
35 |
36 | static public void Write(string msg, LOG_LEVEL logLevel = LOG_LEVEL.TRACE,
37 | [CallerFilePath] string fileName = "",
38 | [CallerMemberName] string methodName = "",
39 | [CallerLineNumber] int lineNumber = 0)
40 | {
41 | if (CurrentLogLevel() <= logLevel)
42 | {
43 | logMsgQueue.Enqueue(string.Format("{0}:{1}| {2}", DateTime.Now, methodName, msg));
44 | }
45 | }
46 |
47 | static public bool GetLog(out string msg)
48 | {
49 | if (logMsgQueue.TryDequeue(out msg))
50 | {
51 | return true;
52 | }
53 |
54 | return false;
55 | }
56 |
57 | }
58 |
59 |
60 | public enum LOG_LEVEL
61 | {
62 | TRACE,
63 | DEBUG,
64 | INFO,
65 | WARN,
66 | ERROR,
67 | DISABLE
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/PacketBufferManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace csharp_test_client
8 | {
9 | class PacketBufferManager
10 | {
11 | int BufferSize = 0;
12 | int ReadPos = 0;
13 | int WritePos = 0;
14 |
15 | int HeaderSize = 0;
16 | int MaxPacketSize = 0;
17 | byte[] PacketData;
18 | byte[] PacketDataTemp;
19 |
20 | public bool Init(int size, int headerSize, int maxPacketSize)
21 | {
22 | if (size < (maxPacketSize * 2) || size < 1 || headerSize < 1 || maxPacketSize < 1)
23 | {
24 | return false;
25 | }
26 |
27 | BufferSize = size;
28 | PacketData = new byte[size];
29 | PacketDataTemp = new byte[size];
30 | HeaderSize = headerSize;
31 | MaxPacketSize = maxPacketSize;
32 |
33 | return true;
34 | }
35 |
36 | public bool Write(byte[] data, int pos, int size)
37 | {
38 | if (data == null || (data.Length < (pos + size)))
39 | {
40 | return false;
41 | }
42 |
43 | var remainBufferSize = BufferSize - WritePos;
44 |
45 | if (remainBufferSize < size)
46 | {
47 | return false;
48 | }
49 |
50 | Buffer.BlockCopy(data, pos, PacketData, WritePos, size);
51 | WritePos += size;
52 |
53 | if (NextFree() == false)
54 | {
55 | BufferRelocate();
56 | }
57 | return true;
58 | }
59 |
60 | public ArraySegment Read()
61 | {
62 | var enableReadSize = WritePos - ReadPos;
63 |
64 | if (enableReadSize < HeaderSize)
65 | {
66 | return new ArraySegment();
67 | }
68 |
69 | var packetDataSize = BitConverter.ToInt16(PacketData, ReadPos);
70 | if (enableReadSize < packetDataSize)
71 | {
72 | return new ArraySegment();
73 | }
74 |
75 | var completePacketData = new ArraySegment(PacketData, ReadPos, packetDataSize);
76 | ReadPos += packetDataSize;
77 | return completePacketData;
78 | }
79 |
80 | bool NextFree()
81 | {
82 | var enableWriteSize = BufferSize - WritePos;
83 |
84 | if (enableWriteSize < MaxPacketSize)
85 | {
86 | return false;
87 | }
88 |
89 | return true;
90 | }
91 |
92 | void BufferRelocate()
93 | {
94 | var enableReadSize = WritePos - ReadPos;
95 |
96 | Buffer.BlockCopy(PacketData, ReadPos, PacketDataTemp, 0, enableReadSize);
97 | Buffer.BlockCopy(PacketDataTemp, 0, PacketData, 0, enableReadSize);
98 |
99 | ReadPos = 0;
100 | WritePos = enableReadSize;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/PacketDefine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace csharp_test_client
8 | {
9 | class PacketDef
10 | {
11 | public const Int16 PACKET_HEADER_SIZE = 5;
12 | public const int MAX_USER_ID_BYTE_LENGTH = 16;
13 | public const int MAX_USER_PW_BYTE_LENGTH = 16;
14 | public const int MAX_CHAT_MSG_SIZE = 256;
15 | }
16 |
17 | public enum PACKET_ID : ushort
18 | {
19 | DEV_ECHO = 181,
20 |
21 | // 로그인
22 | LOGIN_REQ = 201,
23 | LOGIN_RES = 202,
24 |
25 | ROOM_ENTER_REQ = 206,
26 | ROOM_ENTER_RES = 207,
27 | ROOM_NEW_USER_NTF = 208,
28 | ROOM_USER_LIST_NTF = 209,
29 |
30 | ROOM_LEAVE_REQ = 216,
31 | ROOM_LEAVE_RES = 217,
32 | ROOM_LEAVE_USER_NTF = 218,
33 |
34 | ROOM_CHAT_REQ = 221,
35 | ROOM_CHAT_RES = 222,
36 | ROOM_CHAT_NOTIFY = 223,
37 |
38 | }
39 |
40 |
41 | public enum ERROR_CODE : Int16
42 | {
43 | ERROR_NONE = 0,
44 |
45 |
46 |
47 | ERROR_CODE_USER_MGR_INVALID_USER_UNIQUEID = 112,
48 |
49 | ERROR_CODE_PUBLIC_CHANNEL_IN_USER = 114,
50 |
51 | ERROR_CODE_PUBLIC_CHANNEL_INVALIDE_NUMBER = 115,
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace csharp_test_client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 해당 응용 프로그램의 주 진입점입니다.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new mainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
6 | // 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
7 | // 이러한 특성 값을 변경하세요.
8 | [assembly: AssemblyTitle("csharp_test_client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("csharp_test_client")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("9e4b5e72-4e76-4e22-90b0-e53275a99018")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 이 코드는 도구를 사용하여 생성되었습니다.
4 | // 런타임 버전:4.0.30319.42000
5 | //
6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7 | // 이러한 변경 내용이 손실됩니다.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
17 | ///
18 | // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
19 | // 클래스에서 자동으로 생성되었습니다.
20 | // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
21 | // ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("csharp_test_client.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해
56 | /// 현재 스레드의 CurrentUICulture 속성을 재정의합니다.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/csharp_test_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_test_client", "csharp_test_client.csproj", "{9E4B5E72-4E76-4E22-90B0-E53275A99018}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatClient/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/ChatServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChatServer", "ChatServer.vcxproj", "{8ACA22DB-5483-4B0A-8B2A-E184C085483B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.ActiveCfg = Debug|x64
17 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.Build.0 = Debug|x64
18 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.Build.0 = Debug|Win32
20 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.ActiveCfg = Release|x64
21 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.Build.0 = Release|x64
22 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.ActiveCfg = Release|Win32
23 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/ChatServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/ErrorCode.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // 201 부터 시작한다.
5 | enum class ERROR_CODE : short
6 | {
7 | NONE = 0,
8 |
9 | USER_MGR_INVALID_USER_INDEX = 11,
10 | USER_MGR_INVALID_USER_UNIQUEID = 12,
11 |
12 | LOGIN_USER_ALREADY = 31,
13 | LOGIN_USER_USED_ALL_OBJ = 32,
14 |
15 | NEW_ROOM_USED_ALL_OBJ = 41,
16 | NEW_ROOM_FAIL_ENTER = 42,
17 |
18 | ENTER_ROOM_NOT_FINDE_USER = 51,
19 | ENTER_ROOM_INVALID_USER_STATUS = 52,
20 | ENTER_ROOM_NOT_USED_STATUS = 53,
21 | ENTER_ROOM_FULL_USER = 54,
22 |
23 | ROOM_INVALID_INDEX = 61,
24 | ROOM_NOT_USED = 62,
25 | ROOM_TOO_MANY_PACKET = 63,
26 |
27 | LEAVE_ROOM_INVALID_ROOM_INDEX = 71,
28 |
29 | CHAT_ROOM_INVALID_ROOM_NUMBER = 81,
30 | };
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/Packet.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "PacketID.h"
4 | #include "ErrorCode.h"
5 |
6 | #include
7 |
8 |
9 | struct RecvPacketInfo
10 | {
11 | int SessionIndex = 0;
12 | UINT16 PacketID = 0;
13 | UINT16 PacketBodySize = 0;
14 | char* pBodyData = 0;
15 | };
16 |
17 |
18 | #pragma pack(push, 1)
19 | struct PACKET_HEADER
20 | {
21 | UINT16 PacketSize;
22 | UINT16 PacketID;
23 | UINT8 Type; //압축여부 암호화여부 등 속성을 알아내는 값
24 | };
25 |
26 | //- 로그인 요청
27 | const int MAX_USER_ID_LEN = 16;
28 | const int MAX_USER_PW_LEN = 16;
29 |
30 | struct LOGIN_REQUEST_PACKET
31 | {
32 | char UserID[MAX_USER_ID_LEN];
33 | char UserPW[MAX_USER_PW_LEN];
34 | };
35 |
36 | struct LOGIN_RESPONSE_PACKET : public PACKET_HEADER
37 | {
38 | UINT16 Result;
39 | };
40 |
41 |
42 |
43 | //- 룸에 들어가기 요청
44 | const int MAX_ROOM_TITLE_SIZE = 16;
45 | struct ROOM_ENTER_REQUEST_PACKET
46 | {
47 | INT32 RoomNumber;
48 | };
49 |
50 | struct ROOM_ENTER_RESPONSE_PACKET : public PACKET_HEADER
51 | {
52 | INT16 Result;
53 | char RivalUserID[MAX_USER_ID_LEN + 1] = { 0, };
54 | };
55 |
56 |
57 | //- 룸 나가기 요청
58 | struct ROOM_LEAVE_REQUEST_PACKET
59 | {
60 | };
61 |
62 | struct ROOM_LEAVE_RESPONSE_PACKET : public PACKET_HEADER
63 | {
64 | INT16 Result;
65 | };
66 |
67 |
68 |
69 | // 룸 채팅
70 | const int MAX_CHAT_MSG_SIZE = 256;
71 | struct ROOM_CHAT_REQUEST_PACKET
72 | {
73 | char Message[MAX_CHAT_MSG_SIZE] = { 0, };
74 | };
75 |
76 | struct ROOM_CHAT_RESPONSE_PACKET : public PACKET_HEADER
77 | {
78 | INT16 Result;
79 | };
80 |
81 | struct ROOM_CHAT_NOTIFY_PACKET : public PACKET_HEADER
82 | {
83 | char UserID[MAX_USER_ID_LEN] = { 0, };
84 | char Msg[MAX_CHAT_MSG_SIZE] = { 0, };
85 | };
86 |
87 | #pragma pack(pop)
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/PacketID.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // 21 이상부터 시작해야 한다!!!
4 | enum class PACKET_ID : short
5 | {
6 | INTERNAL_BEGIN = 101,
7 |
8 | INTERNAL_CLOSE = 107,
9 |
10 | INTERNAL_END = 150,
11 |
12 |
13 | DEV_ECHO = 181,
14 |
15 |
16 | LOGIN_REQUEST = 201,
17 | LOGIN_RESPONSE = 202,
18 |
19 | ROOM_ENTER_REQUEST = 206,
20 | ROOM_ENTER_RESPONSE = 207,
21 |
22 | ROOM_LEAVE_REQUEST = 216,
23 | ROOM_LEAVE_RESPONSE = 217,
24 |
25 | ROOM_CHAT_REQUEST = 221,
26 | ROOM_CHAT_RESPONSE = 222,
27 | ROOM_CHAT_NOTIFY = 223,
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/PacketManager.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2021-03-17/ChatServer/PacketManager.cpp
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/PacketManager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | #include "UserManager.h"
6 | #include "RoomManager.h"
7 |
8 |
9 |
10 | class PacketManager {
11 | public:
12 | PacketManager() = default;
13 | ~PacketManager() = default;
14 |
15 | void Init(const int maxSessionCount);
16 |
17 | void Process(INT32 connectionIndex, const UINT16 packetID, char* pBuf, INT16 bodySize);
18 |
19 | void ProcessDevEcho(INT32 connIndex, char* pBodyData, INT16 bodySize);
20 |
21 | void ProcessDisConnected(INT32 connIndex, char* pBodyData, INT16 bodySize);
22 |
23 | void ProcessLogin(INT32 connIndex, char* pBodyData, INT16 bodySize);
24 | void ProcessEnterRoom(INT32 connIndex, char* pBodyData, INT16 bodySize);
25 | void ProcessLeaveRoom(INT32 connIndex, char* pBodyData, INT16 bodySize);
26 | void ProcessRoomChatMessage(INT32 connIndex, char* pBodyData, INT16 bodySize);
27 |
28 |
29 |
30 | std::function SendPacketFunc;
31 |
32 |
33 | private:
34 | typedef void(PacketManager::* PROCESS_RECV_PACKET_FUNCTION)(INT32, char*, INT16);
35 | std::unordered_map m_RecvFuntionDictionary;
36 |
37 | UserManager mUserManager;
38 | RoomManager mRoomManager;
39 |
40 |
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/RecvRingBuffer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class RecvRingBuffer
4 | {
5 | public:
6 | RecvRingBuffer() = default;
7 |
8 | ~RecvRingBuffer()
9 | {
10 | delete[] m_pRingBuffer;
11 | }
12 |
13 |
14 | bool Create(const int ringBufferSize)
15 | {
16 | if (ringBufferSize == 0)
17 | {
18 | return false;
19 | }
20 |
21 | m_RingBufferSize = ringBufferSize;
22 |
23 | delete[] m_pRingBuffer;
24 | m_pRingBuffer = new char[m_RingBufferSize];
25 |
26 | Init();
27 | return true;
28 | }
29 |
30 | void Init()
31 | {
32 | m_ReadPos = 0;
33 | m_WritePos = 0;
34 | }
35 |
36 | char* GetWriteBuffer(const int wantedSize)
37 | {
38 | if (auto size = m_RingBufferSize - m_WritePos; size < wantedSize)
39 | {
40 | auto remain = m_WritePos - m_ReadPos;
41 | if (remain <= 0)
42 | {
43 | m_WritePos = 0;
44 | m_ReadPos = 0;
45 | }
46 | else
47 | {
48 | CopyMemory(&m_pRingBuffer[0], &m_pRingBuffer[m_ReadPos], remain);
49 |
50 | m_WritePos = remain;
51 | m_ReadPos = 0;
52 | }
53 | }
54 |
55 | return &m_pRingBuffer[m_WritePos];
56 | }
57 |
58 | std::tuple GetReceiveData(int recvSize)
59 | {
60 | m_WritePos += recvSize;
61 |
62 | auto remain = m_WritePos - m_ReadPos;
63 | return { remain, &m_pRingBuffer[m_ReadPos] };
64 | }
65 |
66 | void ForwardReadPos(const int forwardLength)
67 | {
68 | m_ReadPos += forwardLength;
69 | }
70 |
71 |
72 | int GetBufferSize() { return m_RingBufferSize; }
73 |
74 |
75 | private:
76 | char* m_pRingBuffer = nullptr;
77 | int m_RingBufferSize = 0;
78 | int m_ReadPos = 0;
79 | int m_WritePos = 0;
80 | };
81 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/Room.cpp:
--------------------------------------------------------------------------------
1 | #include "Room.h"
2 | #include "Packet.h"
3 | #define MAX_USER_ID_LEN 20
4 |
5 |
6 | void Room::Init(const Poco::Int32 roomNum, const Poco::Int32 maxUserCount)
7 | {
8 | m_RoomNum = roomNum;
9 | m_MaxUserCount = maxUserCount;
10 | }
11 |
12 | Poco::UInt16 Room::EnterUser(User* pUser)
13 | {
14 | if (m_CurrentUserCount >= m_MaxUserCount)
15 | {
16 | return (Poco::UInt16)ERROR_CODE::ENTER_ROOM_FULL_USER;
17 | }
18 |
19 | m_UserList.push_back(pUser);
20 | ++m_CurrentUserCount;
21 |
22 | pUser->EnterRoom(m_RoomNum);
23 | return (Poco::UInt16)ERROR_CODE::NONE;
24 | }
25 |
26 |
27 | void Room::LeaveUser(User* pLeaveUser)
28 | {
29 | m_UserList.remove_if([leaveUserId = pLeaveUser->GetUserId()](User *pUser) {
30 | return leaveUserId == pUser->GetUserId();
31 | });
32 |
33 | pLeaveUser->LeaveRoom();
34 | }
35 |
36 | void Room::NotifyChat(Poco::Int32 connIndex, const char* UserID, const char* Msg)
37 | {
38 | ROOM_CHAT_NOTIFY_PACKET roomChatNtfyPkt;
39 | roomChatNtfyPkt.PacketID = (UINT16)PACKET_ID::ROOM_CHAT_NOTIFY;
40 | roomChatNtfyPkt.PacketSize = sizeof(roomChatNtfyPkt);
41 |
42 | CopyMemory(roomChatNtfyPkt.Msg, Msg, sizeof(roomChatNtfyPkt.Msg));
43 | CopyMemory(roomChatNtfyPkt.UserID, UserID, sizeof(roomChatNtfyPkt.UserID));
44 | SendToAllUser(sizeof(roomChatNtfyPkt), (char*)&roomChatNtfyPkt, -1, false);
45 | }
46 |
47 |
48 | void Room::SendToAllUser(const Poco::UInt16 dataSize, const char* pData, const Poco::Int32 passUserindex, bool exceptMe)
49 | {
50 |
51 | for (auto pUser : m_UserList)
52 | {
53 | if (pUser == nullptr) {
54 | continue;
55 | }
56 |
57 | if (exceptMe && pUser->GetNetConnIdx() == passUserindex) {
58 | continue;
59 | }
60 |
61 | SendPacketFunc(pUser->GetNetConnIdx(), pData, dataSize);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/Room.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "UserManager.h"
5 |
6 |
7 | class Room
8 | {
9 | public:
10 | Room() = default;
11 | ~Room() = default;
12 |
13 | void Init(const Poco::Int32 roomNum, const Poco::Int32 maxUserCount);
14 |
15 | INT32 GetMaxUserCount() { return m_MaxUserCount; }
16 |
17 | INT32 GetCurrentUserCount() { return m_CurrentUserCount; }
18 |
19 | INT32 GetRoomNumber() { return m_RoomNum; }
20 |
21 | UINT16 EnterUser(User* pUser);
22 |
23 | void LeaveUser(User* pUser);
24 |
25 | void NotifyChat(int connIndex, const char* UserID, const char* Msg);
26 |
27 |
28 | std::function SendPacketFunc;
29 |
30 | private:
31 | void SendToAllUser(const Poco::UInt16 dataSize, const char* pData, const Poco::Int32 passUserindex, bool exceptMe);
32 |
33 |
34 | Poco::Int32 m_RoomNum = -1;
35 |
36 | std::list m_UserList;
37 |
38 | Poco::Int32 m_MaxUserCount = 0;
39 |
40 | Poco::UInt16 m_CurrentUserCount = 0;
41 | };
42 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/RoomManager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Room.h"
3 |
4 | class RoomManager
5 | {
6 | public:
7 | RoomManager() = default;
8 | ~RoomManager() = default;
9 |
10 | void Init(const Poco::Int32 beginRoomNumber, const Poco::Int32 maxRoomCount, const Poco::Int32 maxRoomUserCount)
11 | {
12 | m_BeginRoomNumber = beginRoomNumber;
13 | m_MaxRoomCount = maxRoomCount;
14 | m_EndRoomNumber = beginRoomNumber + maxRoomCount;
15 |
16 | m_RoomList = std::vector(maxRoomCount);
17 |
18 | for (auto i = 0; i < maxRoomCount; i++)
19 | {
20 | m_RoomList[i] = new Room();
21 | m_RoomList[i]->SendPacketFunc = SendPacketFunc;
22 | m_RoomList[i]->Init((i+ beginRoomNumber), maxRoomUserCount);
23 | }
24 | }
25 |
26 | Poco::UInt32 GetMaxRoomCount() { return m_MaxRoomCount; }
27 |
28 | Poco::UInt16 EnterUser(Poco::Int32 roomNumber, User* pUser)
29 | {
30 | auto pRoom = GetRoomByNumber(roomNumber);
31 | if (pRoom == nullptr)
32 | {
33 | return (Poco::UInt16)ERROR_CODE::ROOM_INVALID_INDEX;
34 | }
35 |
36 |
37 | return pRoom->EnterUser(pUser);
38 | }
39 |
40 | INT16 LeaveUser(Poco::Int32 roomIndex, User* pUser)
41 | {
42 | auto pRoom = GetRoomByNumber(roomIndex);
43 | if (pRoom == nullptr)
44 | {
45 | return (Poco::Int16)ERROR_CODE::ROOM_INVALID_INDEX;
46 | }
47 |
48 | pRoom->LeaveUser(pUser);
49 | return (Poco::Int16)ERROR_CODE::NONE;
50 | }
51 |
52 | Room* GetRoomByNumber(Poco::Int32 number)
53 | {
54 | if (number < m_BeginRoomNumber || number >= m_EndRoomNumber)
55 | {
56 | return nullptr;
57 | }
58 |
59 | auto index = (number - m_BeginRoomNumber);
60 | return m_RoomList[index];
61 | }
62 |
63 |
64 | std::function SendPacketFunc;
65 |
66 |
67 | private:
68 | std::vector m_RoomList;
69 | Poco::Int32 m_BeginRoomNumber = 0;
70 | Poco::Int32 m_EndRoomNumber = 0;
71 | Poco::Int32 m_MaxRoomCount = 0;
72 | };
73 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/Session.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "RecvRingBuffer.h"
7 |
8 |
9 | class Session
10 | {
11 | public:
12 | Session(Poco::Net::StreamSocket& socket, Poco::Net::SocketReactor& reactor) :
13 | m_socket(socket),
14 | m_reactor(reactor)
15 | {
16 | mRecvBuffer.Create(1024*8);
17 |
18 | m_peerAddress = socket.peerAddress().toString();
19 | std::cout << "connection from " << m_peerAddress << " ..." << std::endl;
20 |
21 | m_reactor.addEventHandler(m_socket,
22 | Poco::Observer(*this, &Session::onReadable));
23 |
24 | OnConnection(this);
25 | }
26 |
27 | ~Session()
28 | {
29 | std::cout << m_peerAddress << " disconnected ..." << std::endl;
30 | }
31 |
32 |
33 | static std::function OnConnection;
34 | static std::function OnClose;
35 | static std::function AddPacketFunc;
36 |
37 |
38 | void SetIndex(const int index) { mIndex = index; }
39 | int GetIndex() { return mIndex; }
40 |
41 |
42 | void onReadable(Poco::Net::ReadableNotification* pNf)
43 | {
44 | pNf->release();
45 |
46 | try
47 | {
48 | auto pBuffer = mRecvBuffer.GetWriteBuffer(1024);
49 |
50 | int recvSize = m_socket.receiveBytes(pBuffer, 1024);
51 | if (recvSize > 0)
52 | {
53 | auto [remainSize, pRemainData ] = mRecvBuffer.GetReceiveData(recvSize);
54 |
55 | auto deliveredSize = ToPacketProcess(remainSize, pRemainData);
56 |
57 | mRecvBuffer.ForwardReadPos(deliveredSize);
58 | }
59 | else
60 | {
61 | Close();
62 | }
63 | }
64 | catch (Poco::Exception ex)
65 | {
66 | Close();
67 | }
68 | }
69 |
70 | void SendPacket(const char* pData, const int size)
71 | {
72 | if (mIsConnected == false)
73 | {
74 | return;
75 | }
76 |
77 | m_socket.sendBytes(pData, size);
78 | }
79 |
80 |
81 | private:
82 | int ToPacketProcess(int remainByte, char* pBuffer)
83 | {
84 | const int MAX_PACKET_SIZE = 1024;
85 | const int PACKET_HEADER_LENGTH = 5;
86 | const int PACKET_SIZE_LENGTH = 2;
87 | const int PACKET_TYPE_LENGTH = 2;
88 |
89 | int totalReadSize = 0;
90 |
91 | while (true)
92 | {
93 | if (remainByte < PACKET_HEADER_LENGTH)
94 | {
95 | break;
96 | }
97 |
98 | auto pHeader = (PACKET_HEADER*)pBuffer;
99 |
100 | if (pHeader->PacketSize > MAX_PACKET_SIZE)
101 | {
102 | break;
103 | }
104 |
105 | if (remainByte < pHeader->PacketSize)
106 | {
107 | break;
108 | }
109 |
110 | auto bodySize = pHeader->PacketSize - PACKET_HEADER_LENGTH;
111 | auto packetID = pBuffer[PACKET_SIZE_LENGTH];
112 | AddPacketFunc(false, mIndex, pHeader->PacketID, bodySize, &pBuffer[PACKET_HEADER_LENGTH]);
113 |
114 | remainByte -= pHeader->PacketSize;
115 | totalReadSize += pHeader->PacketSize;
116 | pBuffer += pHeader->PacketSize;
117 |
118 | }
119 |
120 | return totalReadSize;
121 | }
122 |
123 | void Close()
124 | {
125 | mIsConnected = false;
126 |
127 | m_socket.close();
128 |
129 | m_reactor.removeEventHandler(m_socket,
130 | Poco::Observer(*this, &Session::onReadable)
131 | );
132 |
133 | OnClose(this);
134 | }
135 |
136 | Poco::Net::StreamSocket m_socket;
137 | std::string m_peerAddress;
138 | Poco::Net::SocketReactor& m_reactor;
139 |
140 | int mIndex;
141 | bool mIsConnected = true;
142 | RecvRingBuffer mRecvBuffer;
143 | };
144 |
145 | inline std::function Session::OnConnection;
146 | inline std::function Session::OnClose;
147 | inline std::function Session::AddPacketFunc;
148 |
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/User.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | //#define POCO_STATIC
4 | #include
5 |
6 | #include
7 |
8 | #include "Packet.h"
9 |
10 |
11 |
12 |
13 | class User
14 | {
15 | public:
16 | User() = default;
17 | ~User() = default;
18 |
19 | void Init(const Poco::Int32 index)
20 | {
21 | m_Index = index;
22 | }
23 |
24 | void Clear()
25 | {
26 | m_RoomIndex = -1;
27 | m_UserId = "";
28 | m_IsConfirm = false;
29 | }
30 |
31 | int SetLogin(char* login_id)
32 | {
33 | m_IsConfirm = true;
34 | m_UserId = login_id;
35 |
36 | return 0;
37 | }
38 |
39 | void EnterRoom(Poco::Int32 roomIndex) { m_RoomIndex = roomIndex; }
40 | void LeaveRoom() { m_RoomIndex = -1; }
41 |
42 | Poco::Int32 GetCurrentRoomIndex()
43 | {
44 | return m_RoomIndex;
45 | }
46 |
47 | Poco::Int32 GetNetConnIdx()
48 | {
49 | return m_Index;
50 | }
51 |
52 | std::string GetUserId() const
53 | {
54 | return m_UserId;
55 | }
56 |
57 | bool IsCurInRoom() { return m_RoomIndex > -1 ? true : false; }
58 |
59 |
60 | private:
61 | Poco::Int32 m_RoomIndex = -1;
62 | bool m_IsConfirm = false;
63 |
64 | std::string m_UserId;
65 |
66 | std::string AuthToken;
67 |
68 | Poco::Int32 m_Index = -1;
69 | };
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/UserManager.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2021-03-17/ChatServer/UserManager.h
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer/main.cpp:
--------------------------------------------------------------------------------
1 | #define POCO_STATIC
2 |
3 | #include
4 |
5 | #include "ChatServer.h"
6 |
7 | const Poco::UInt16 PORT = 11021;
8 | const int MAX_CONNECT_COUNT = 256;
9 |
10 | int main()
11 | {
12 | ChatServer chatServer;
13 |
14 | chatServer.Init(MAX_CONNECT_COUNT);
15 | chatServer.Start(PORT);
16 |
17 | return 0;
18 | }
--------------------------------------------------------------------------------
/Semina_2021-03-17/ChatServer_codeFlow.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/Semina_2021-03-17/ChatServer_codeFlow.xlsx
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_client/block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/04_block_echo_client/block_echo_client.cpp
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_client/block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_client", "block_echo_client.vcxproj", "{5A2784AB-5A3D-43ED-BC74-37906EC2086B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.ActiveCfg = Debug|x64
17 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x64.Build.0 = Debug|x64
18 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Debug|x86.Build.0 = Debug|Win32
20 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.ActiveCfg = Release|x64
21 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x64.Build.0 = Release|x64
22 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.ActiveCfg = Release|Win32
23 | {5A2784AB-5A3D-43ED-BC74-37906EC2086B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_client/block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_server/block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/04_block_echo_server/block_echo_server.cpp
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_server/block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "block_echo_server", "block_echo_server.vcxproj", "{298BED35-EBB3-4655-B7D0-5D1EFB119251}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.ActiveCfg = Debug|x64
17 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x64.Build.0 = Debug|x64
18 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.ActiveCfg = Debug|Win32
19 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Debug|x86.Build.0 = Debug|Win32
20 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.ActiveCfg = Release|x64
21 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x64.Build.0 = Release|x64
22 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.ActiveCfg = Release|Win32
23 | {298BED35-EBB3-4655-B7D0-5D1EFB119251}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/04_block_echo_server/block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_client/udp_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/05_block_echo_udp_client/udp_client.cpp
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_client/udp_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp_client", "udp_client.vcxproj", "{E2C85060-5423-4F39-BD25-1D41CC8CFF7F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x64.ActiveCfg = Debug|x64
17 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x64.Build.0 = Debug|x64
18 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Debug|x86.Build.0 = Debug|Win32
20 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x64.ActiveCfg = Release|x64
21 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x64.Build.0 = Release|x64
22 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x86.ActiveCfg = Release|Win32
23 | {E2C85060-5423-4F39-BD25-1D41CC8CFF7F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_client/udp_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_server/udp_server.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 |
7 | const Poco::UInt16 MY_PORT = 32452;
8 |
9 |
10 | int main()
11 | {
12 | Poco::Net::DatagramSocket serv_sock(MY_PORT);
13 | Poco::Net::SocketAddress client;
14 |
15 | while (true)
16 | {
17 | try
18 | {
19 | char buffer[256] = { 0, };
20 | Poco::Net::SocketAddress sender;
21 | int len = serv_sock.receiveFrom(buffer, sizeof(buffer), sender);
22 |
23 | if (len > 0)
24 | {
25 | std::cout << buffer << " from " << sender.host().toString() << ":" << sender.port() << std::endl;
26 |
27 |
28 | char szSendMessage[256] = { 0, };
29 | sprintf_s(szSendMessage, 256 - 1, "Re:%s", buffer);
30 | int nMsgLen = (int)strnlen_s(szSendMessage, 256 - 1);
31 |
32 | serv_sock.sendTo(szSendMessage, nMsgLen, sender);
33 | }
34 | }
35 | catch (Poco::Exception& exc)
36 | {
37 | std::cout << "UDPEchoServer: " << exc.displayText() << std::endl;
38 | }
39 | }
40 |
41 | return(0);
42 | }
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_server/udp_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp_server", "udp_server.vcxproj", "{59020818-4B4C-4EB1-9152-E47D3B013FE1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x64.ActiveCfg = Debug|x64
17 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x64.Build.0 = Debug|x64
18 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x86.ActiveCfg = Debug|Win32
19 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Debug|x86.Build.0 = Debug|Win32
20 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x64.ActiveCfg = Release|x64
21 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x64.Build.0 = Release|x64
22 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x86.ActiveCfg = Release|Win32
23 | {59020818-4B4C-4EB1-9152-E47D3B013FE1}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/05_block_echo_udp_server/udp_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_client/non-block_echo_client.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/06_non-block_echo_client/non-block_echo_client.cpp
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_client/non-block_echo_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_client", "non-block_echo_client.vcxproj", "{C37579F2-ECAA-47A1-A07A-6A5F37265F76}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.ActiveCfg = Debug|x64
17 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x64.Build.0 = Debug|x64
18 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.ActiveCfg = Debug|Win32
19 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Debug|x86.Build.0 = Debug|Win32
20 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.ActiveCfg = Release|x64
21 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x64.Build.0 = Release|x64
22 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.ActiveCfg = Release|Win32
23 | {C37579F2-ECAA-47A1-A07A-6A5F37265F76}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_client/non-block_echo_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_server/non-block_echo_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/06_non-block_echo_server/non-block_echo_server.cpp
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_server/non-block_echo_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "non-block_echo_server", "non-block_echo_server.vcxproj", "{4D678968-F02A-41F8-AC29-67B8A8FDE54F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.ActiveCfg = Debug|x64
17 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x64.Build.0 = Debug|x64
18 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.ActiveCfg = Debug|Win32
19 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Debug|x86.Build.0 = Debug|Win32
20 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.ActiveCfg = Release|x64
21 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x64.Build.0 = Release|x64
22 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.ActiveCfg = Release|Win32
23 | {4D678968-F02A-41F8-AC29-67B8A8FDE54F}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/06_non-block_echo_server/non-block_echo_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/07_simple_TCPServer/simple_TCPServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/07_simple_TCPServer/simple_TCPServer.cpp
--------------------------------------------------------------------------------
/exampleCodes/07_simple_TCPServer/simple_TCPServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_TCPServer", "simple_TCPServer.vcxproj", "{3FE81E07-88CD-48AD-A766-849407759BA4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.ActiveCfg = Debug|x64
17 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.Build.0 = Debug|x64
18 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.Build.0 = Debug|Win32
20 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.ActiveCfg = Release|x64
21 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.Build.0 = Release|x64
22 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.ActiveCfg = Release|Win32
23 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/07_simple_TCPServer/simple_TCPServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/08_changeSetting_TCPServer/changeSetting_TCPServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/08_changeSetting_TCPServer/changeSetting_TCPServer.cpp
--------------------------------------------------------------------------------
/exampleCodes/08_changeSetting_TCPServer/changeSetting_TCPServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "changeSetting_TCPServer", "changeSetting_TCPServer.vcxproj", "{3FE81E07-88CD-48AD-A766-849407759BA4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.ActiveCfg = Debug|x64
17 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x64.Build.0 = Debug|x64
18 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Debug|x86.Build.0 = Debug|Win32
20 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.ActiveCfg = Release|x64
21 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x64.Build.0 = Release|x64
22 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.ActiveCfg = Release|Win32
23 | {3FE81E07-88CD-48AD-A766-849407759BA4}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/08_changeSetting_TCPServer/changeSetting_TCPServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/09_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/09_parallelreactor_EchoServer/parallelreactor_EchoServer.cpp
--------------------------------------------------------------------------------
/exampleCodes/09_parallelreactor_EchoServer/parallelreactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallelreactor_EchoServer", "parallelreactor_EchoServer.vcxproj", "{8ACA22DB-5483-4B0A-8B2A-E184C085483B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.ActiveCfg = Debug|x64
17 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x64.Build.0 = Debug|x64
18 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Debug|x86.Build.0 = Debug|Win32
20 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.ActiveCfg = Release|x64
21 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x64.Build.0 = Release|x64
22 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.ActiveCfg = Release|Win32
23 | {8ACA22DB-5483-4B0A-8B2A-E184C085483B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/09_parallelreactor_EchoServer/parallelreactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoClient/reactor_EchoClient.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/09_reactor_EchoClient/reactor_EchoClient.cpp
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoClient/reactor_EchoClient.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoClient/reactor_EchoClient.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EchoClient", "reactor_EchoClient.vcxproj", "{7615B379-7F8F-406E-BDAC-CEDB48C37739}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.ActiveCfg = Debug|x64
17 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x64.Build.0 = Debug|x64
18 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.ActiveCfg = Debug|Win32
19 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Debug|x86.Build.0 = Debug|Win32
20 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.ActiveCfg = Release|x64
21 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x64.Build.0 = Release|x64
22 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.ActiveCfg = Release|Win32
23 | {7615B379-7F8F-406E-BDAC-CEDB48C37739}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoServer/reactor_EchoServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/09_reactor_EchoServer/reactor_EchoServer.cpp
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoServer/reactor_EchoServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EchoServer", "reactor_EchoServer.vcxproj", "{06B4D279-3571-412F-9838-5B8F1106F22B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.ActiveCfg = Debug|x64
17 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x64.Build.0 = Debug|x64
18 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Debug|x86.Build.0 = Debug|Win32
20 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.ActiveCfg = Release|x64
21 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x64.Build.0 = Release|x64
22 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.ActiveCfg = Release|Win32
23 | {06B4D279-3571-412F-9838-5B8F1106F22B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EchoServer/reactor_EchoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EcohoServerEx/reactor_EcohoServerEx.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 |
7 | const Poco::UInt16 PORT = 32452;
8 |
9 |
10 | class Session {
11 | public:
12 | Session(Poco::Net::StreamSocket& socket, Poco::Net::SocketReactor& reactor) :
13 | m_Socket(socket),
14 | m_Reactor(reactor)
15 | {
16 | m_PeerAddress = socket.peerAddress().toString();
17 |
18 | std::cout << "connection from " << m_PeerAddress << " ..." << std::endl;
19 |
20 | // 데이터 읽기 가능할 때 발생하는 이벤트
21 | m_Reactor.addEventHandler(m_Socket,
22 | Poco::Observer(*this, &Session::onReadable));
23 |
24 | // SocketReactor가 셧다운 할 때 발생하는 이벤트
25 | m_Reactor.addEventHandler(m_Socket,
26 | Poco::Observer(*this, &Session::onShutdown));
27 |
28 | // 소켓에 에러가 생겼을 때 발생하는 이벤트
29 | m_Reactor.addEventHandler(m_Socket,
30 | Poco::Observer(*this, &Session::onError));
31 |
32 | // Poco::Net::select 호출 시 react 할 소켓이 없는 경우 발생하는 이벤트
33 | m_Reactor.addEventHandler(m_Socket,
34 | Poco::Observer(*this, &Session::onIdle));
35 |
36 | // Poco::Net::select 호출 후 지정 시간까지 이벤트가 없을 때 발생하는 이벤트
37 | m_Reactor.addEventHandler(m_Socket,
38 | Poco::Observer(*this, &Session::onTimeout));
39 |
40 | }
41 |
42 | ~Session()
43 | {
44 | std::cout << m_PeerAddress << " disconnected ..." << std::endl;
45 |
46 | m_Reactor.removeEventHandler(m_Socket,
47 | Poco::Observer(*this, &Session::onReadable)
48 | );
49 |
50 | m_Reactor.removeEventHandler(m_Socket,
51 | Poco::Observer(*this, &Session::onShutdown)
52 | );
53 |
54 | m_Reactor.removeEventHandler(m_Socket,
55 | Poco::Observer(*this, &Session::onError)
56 | );
57 |
58 | m_Reactor.removeEventHandler(m_Socket,
59 | Poco::Observer(*this, &Session::onIdle)
60 | );
61 |
62 | m_Reactor.removeEventHandler(m_Socket,
63 | Poco::Observer(*this, &Session::onTimeout)
64 | );
65 | }
66 |
67 | void onReadable(Poco::Net::ReadableNotification* pNf)
68 | {
69 | pNf->release();
70 |
71 | char buffer[256] = { 0, };
72 | int n = m_Socket.receiveBytes(buffer, sizeof(buffer));
73 | if (n > 0)
74 | {
75 | std::cout << "클라이언트에서 받은 메시지: " << buffer << std::endl;
76 |
77 | char szSendMessage[256] = { 0, };
78 | sprintf_s(szSendMessage, 256 - 1, "Re:%s", buffer);
79 | int nMsgLen = (int)strnlen_s(szSendMessage, 256 - 1);
80 |
81 | m_Socket.sendBytes(szSendMessage, nMsgLen);
82 | }
83 | else
84 | {
85 | m_Socket.shutdownSend();
86 | delete this;
87 | }
88 | }
89 |
90 | void onShutdown(Poco::Net::ShutdownNotification* pNf)
91 | {
92 | pNf->release();
93 |
94 | std::cout << "onShutdown 발생" << std::endl;
95 | }
96 |
97 | void onError(Poco::Net::ErrorNotification* pNf)
98 | {
99 | pNf->release();
100 |
101 | std::cout << "onError 발생" << std::endl;
102 | }
103 |
104 | void onTimeout(Poco::Net::TimeoutNotification* pNf)
105 | {
106 | pNf->release();
107 |
108 | std::cout << "onTimeout 발생" << std::endl;
109 | }
110 |
111 | void onIdle(Poco::Net::IdleNotification* pNf)
112 | {
113 | pNf->release();
114 |
115 | std::cout << "onIdle 발생" << std::endl;
116 | }
117 |
118 | private:
119 | Poco::Net::StreamSocket m_Socket;
120 | std::string m_PeerAddress;
121 | Poco::Net::SocketReactor& m_Reactor;
122 | };
123 |
124 |
125 |
126 | int main()
127 | {
128 | Poco::Timespan timeout(10, 0);
129 | Poco::Net::SocketReactor reactor(timeout);
130 |
131 | Poco::Net::ServerSocket serverSocket(PORT);
132 |
133 | Poco::Net::SocketAcceptor acceptor(serverSocket, reactor);
134 |
135 |
136 | std::cout << "Reactor: starting..." << std::endl;
137 |
138 | reactor.run();
139 |
140 |
141 | std::cout << "Reactor: 종료..." << std::endl;
142 | getchar();
143 | return 0;
144 | }
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EcohoServerEx/reactor_EcohoServerEx.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactor_EcohoServerEx", "reactor_EcohoServerEx.vcxproj", "{36C9E62D-01FA-4104-8140-8490CD245D58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.ActiveCfg = Debug|x64
17 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x64.Build.0 = Debug|x64
18 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.ActiveCfg = Debug|Win32
19 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Debug|x86.Build.0 = Debug|Win32
20 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.ActiveCfg = Release|x64
21 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x64.Build.0 = Release|x64
22 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.ActiveCfg = Release|Win32
23 | {36C9E62D-01FA-4104-8140-8490CD245D58}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/09_reactor_EcohoServerEx/reactor_EcohoServerEx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_client/http_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_client", "http_client.vcxproj", "{426CE2BF-FA5A-465E-AA63-D2A48946C58B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.ActiveCfg = Debug|x64
17 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.Build.0 = Debug|x64
18 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.Build.0 = Debug|Win32
20 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.ActiveCfg = Release|x64
21 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.Build.0 = Release|x64
22 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.ActiveCfg = Release|Win32
23 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_client/http_client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_client/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | int Get()
11 | {
12 | try
13 | {
14 | std::cout << "Get(): Req" << std::endl;
15 |
16 |
17 | Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_GET, "/echo", Poco::Net::HTTPMessage::HTTP_1_1);
18 | req.setContentType("application/x-www-form-urlencoded");
19 |
20 | Poco::Net::HTMLForm form;
21 | form.add("userName", "hello");
22 | form.add("password", "123456");
23 | form.prepareSubmit(req);
24 |
25 | Poco::Net::HTTPClientSession session("127.0.0.1", 19980);
26 | std::ostream& ostr = session.sendRequest(req);
27 | form.write(ostr);
28 |
29 |
30 | Poco::Net::HTTPResponse res;
31 | std::istream& is = session.receiveResponse(res);
32 |
33 | std::string strResponse;
34 | Poco::StreamCopier::copyToString(is, strResponse);
35 | std::cout << "Get(): Res" << strResponse << std::endl;
36 | }
37 | catch (Poco::Exception& exc)
38 | {
39 | return -1;
40 | }
41 |
42 | return 0;
43 | }
44 |
45 | int Post()
46 | {
47 | try
48 | {
49 | std::cout << "Post(): Req" << std::endl;
50 |
51 |
52 | Poco::Net::HTTPClientSession session("127.0.0.1", 19980);
53 | Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, "/echo");
54 |
55 | std::string body("rs=this is a random request body");
56 | request.setContentLength(body.length());
57 | std::ostream& ostr = session.sendRequest(request);
58 | ostr << body;
59 |
60 | Poco::Net::HTTPResponse res;
61 | std::istream& rs = session.receiveResponse(res);
62 |
63 | std::string strResponse(std::istreambuf_iterator(rs), {});
64 | std::cout << "Get(): Res" << strResponse << std::endl;
65 | }
66 | catch (Poco::Exception& exc)
67 | {
68 | return -1;
69 | }
70 |
71 | return 0;
72 | }
73 |
74 |
75 | int main()
76 | {
77 | Get();
78 |
79 | Post();
80 |
81 | return 0;
82 | }
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_01/http_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/10_http_server_01/http_server.cpp
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_01/http_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_server", "http_server.vcxproj", "{748C3C06-4626-461C-BE35-B685F773EA57}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.ActiveCfg = Debug|x64
17 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.Build.0 = Debug|x64
18 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.ActiveCfg = Debug|Win32
19 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.Build.0 = Debug|Win32
20 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.ActiveCfg = Release|x64
21 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.Build.0 = Release|x64
22 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.ActiveCfg = Release|Win32
23 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_01/http_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_01/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Simple POCO HTTPServer
4 |
5 |
6 |
7 | Hello!
8 |
9 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_02/http_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/10_http_server_02/http_server.cpp
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_02/http_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_server", "http_server.vcxproj", "{748C3C06-4626-461C-BE35-B685F773EA57}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.ActiveCfg = Debug|x64
17 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.Build.0 = Debug|x64
18 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.ActiveCfg = Debug|Win32
19 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.Build.0 = Debug|Win32
20 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.ActiveCfg = Release|x64
21 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.Build.0 = Release|x64
22 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.ActiveCfg = Release|Win32
23 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_02/http_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_03/http_server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/10_http_server_03/http_server.cpp
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_03/http_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_server", "http_server.vcxproj", "{748C3C06-4626-461C-BE35-B685F773EA57}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.ActiveCfg = Debug|x64
17 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.Build.0 = Debug|x64
18 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.ActiveCfg = Debug|Win32
19 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.Build.0 = Debug|Win32
20 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.ActiveCfg = Release|x64
21 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.Build.0 = Release|x64
22 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.ActiveCfg = Release|Win32
23 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/10_http_server_03/http_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_client/client.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 |
9 |
10 |
11 | int main()
12 | {
13 | int flags;
14 |
15 | try
16 | {
17 | Poco::Net::HTTPClientSession cs("localhost", 19980);
18 | Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/ws", "HTTP/1.1");
19 | Poco::Net::HTTPResponse response;
20 | std::string cmd;
21 |
22 | Poco::Net::WebSocket * ws = new Poco::Net::WebSocket(cs, request, response);
23 |
24 | std::string payload = "SGClient: Hello World!";
25 | ws->sendFrame(payload.data(), payload.size(), Poco::Net::WebSocket::FRAME_TEXT);
26 |
27 | char buffer[1024] = { 0, };
28 | int recvDataSize = ws->receiveFrame(buffer, sizeof(buffer), flags);
29 | std::cout << "[recv]" << buffer << std::endl;
30 |
31 | while (true)
32 | {
33 | cmd = "";
34 | std::cin >> cmd;
35 |
36 | if (cmd == "exit")
37 | {
38 | break;
39 | }
40 |
41 | ws->sendFrame(cmd.data(), cmd.size(), Poco::Net::WebSocket::FRAME_TEXT);
42 |
43 | char buffer[1024] = { 0, };
44 | int recvDataSize = ws->receiveFrame(buffer, sizeof(buffer), flags);
45 | if (recvDataSize > 0)
46 | {
47 | std::cout << "[recv]" << buffer << std::endl;
48 | }
49 | }
50 |
51 | ws->shutdown();
52 | }
53 | catch (Poco::Exception ex)
54 | {
55 | std::cout << ex.displayText() << std::endl;
56 | return 0;
57 | }
58 |
59 | return 0;
60 | }
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_client/client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "client.vcxproj", "{426CE2BF-FA5A-465E-AA63-D2A48946C58B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.ActiveCfg = Debug|x64
17 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x64.Build.0 = Debug|x64
18 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.ActiveCfg = Debug|Win32
19 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Debug|x86.Build.0 = Debug|Win32
20 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.ActiveCfg = Release|x64
21 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x64.Build.0 = Release|x64
22 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.ActiveCfg = Release|Win32
23 | {426CE2BF-FA5A-465E-AA63-D2A48946C58B}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_client/client.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_server/server.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacking75/Poco_network_sample/9c6e9aa2da498d9c1a8edfe04ea894e0984cb5b4/exampleCodes/11_websocket_server/server.cpp
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_server/websocket_server.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "websocket_server", "websocket_server.vcxproj", "{748C3C06-4626-461C-BE35-B685F773EA57}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.ActiveCfg = Debug|x64
17 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x64.Build.0 = Debug|x64
18 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.ActiveCfg = Debug|Win32
19 | {748C3C06-4626-461C-BE35-B685F773EA57}.Debug|x86.Build.0 = Debug|Win32
20 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.ActiveCfg = Release|x64
21 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x64.Build.0 = Release|x64
22 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.ActiveCfg = Release|Win32
23 | {748C3C06-4626-461C-BE35-B685F773EA57}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/exampleCodes/11_websocket_server/websocket_server.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/ClientSimpleTcp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Sockets;
3 | using System.Net;
4 |
5 | namespace csharp_test_client
6 | {
7 | public class ClientSimpleTcp
8 | {
9 | public Socket Sock = null;
10 | public string LatestErrorMsg;
11 |
12 |
13 | //소켓연결
14 | public bool Connect(string ip, int port)
15 | {
16 | try
17 | {
18 | IPAddress serverIP = IPAddress.Parse(ip);
19 | int serverPort = port;
20 |
21 | Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
22 | Sock.Connect(new IPEndPoint(serverIP, serverPort));
23 |
24 | if (Sock == null || Sock.Connected == false)
25 | {
26 | return false;
27 | }
28 |
29 | return true;
30 | }
31 | catch (Exception ex)
32 | {
33 | LatestErrorMsg = ex.Message;
34 | return false;
35 | }
36 | }
37 |
38 | public Tuple Receive()
39 | {
40 |
41 | try
42 | {
43 | byte[] ReadBuffer = new byte[2048];
44 | var nRecv = Sock.Receive(ReadBuffer, 0, ReadBuffer.Length, SocketFlags.None);
45 |
46 | if (nRecv == 0)
47 | {
48 | return null;
49 | }
50 |
51 | return Tuple.Create(nRecv,ReadBuffer);
52 | }
53 | catch (SocketException se)
54 | {
55 | LatestErrorMsg = se.Message;
56 | }
57 |
58 | return null;
59 | }
60 |
61 | //스트림에 쓰기
62 | public void Send(byte[] sendData)
63 | {
64 | try
65 | {
66 | if (Sock != null && Sock.Connected) //연결상태 유무 확인
67 | {
68 | Sock.Send(sendData, 0, sendData.Length, SocketFlags.None);
69 | }
70 | else
71 | {
72 | LatestErrorMsg = "먼저 채팅서버에 접속하세요!";
73 | }
74 | }
75 | catch (SocketException se)
76 | {
77 | LatestErrorMsg = se.Message;
78 | }
79 | }
80 |
81 | //소켓과 스트림 닫기
82 | public void Close()
83 | {
84 | if (Sock != null && Sock.Connected)
85 | {
86 | Sock.Shutdown(SocketShutdown.Both);
87 | Sock.Close();
88 | }
89 | }
90 |
91 | public bool IsConnected() { return (Sock != null && Sock.Connected) ? true : false; }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/DevLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using System.Runtime.CompilerServices;
8 | using System.Threading;
9 |
10 | namespace csharp_test_client
11 | {
12 | public class DevLog
13 | {
14 | static System.Collections.Concurrent.ConcurrentQueue logMsgQueue = new System.Collections.Concurrent.ConcurrentQueue();
15 |
16 | static Int64 출력가능_로그레벨 = (Int64)LOG_LEVEL.TRACE;
17 |
18 |
19 |
20 | static public void Init(LOG_LEVEL logLevel)
21 | {
22 | ChangeLogLevel(logLevel);
23 | }
24 |
25 | static public void ChangeLogLevel(LOG_LEVEL logLevel)
26 | {
27 | Interlocked.Exchange(ref 출력가능_로그레벨, (int)logLevel);
28 | }
29 |
30 | public static LOG_LEVEL CurrentLogLevel()
31 | {
32 | var curLogLevel = (LOG_LEVEL)Interlocked.Read(ref 출력가능_로그레벨);
33 | return curLogLevel;
34 | }
35 |
36 | static public void Write(string msg, LOG_LEVEL logLevel = LOG_LEVEL.TRACE,
37 | [CallerFilePath] string fileName = "",
38 | [CallerMemberName] string methodName = "",
39 | [CallerLineNumber] int lineNumber = 0)
40 | {
41 | if (CurrentLogLevel() <= logLevel)
42 | {
43 | logMsgQueue.Enqueue(string.Format("{0}:{1}| {2}", DateTime.Now, methodName, msg));
44 | }
45 | }
46 |
47 | static public bool GetLog(out string msg)
48 | {
49 | if (logMsgQueue.TryDequeue(out msg))
50 | {
51 | return true;
52 | }
53 |
54 | return false;
55 | }
56 |
57 | }
58 |
59 |
60 | public enum LOG_LEVEL
61 | {
62 | TRACE,
63 | DEBUG,
64 | INFO,
65 | WARN,
66 | ERROR,
67 | DISABLE
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace csharp_test_client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// 해당 응용 프로그램의 주 진입점입니다.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new mainForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
6 | // 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
7 | // 이러한 특성 값을 변경하세요.
8 | [assembly: AssemblyTitle("csharp_test_client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("csharp_test_client")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("9e4b5e72-4e76-4e22-90b0-e53275a99018")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 이 코드는 도구를 사용하여 생성되었습니다.
4 | // 런타임 버전:4.0.30319.42000
5 | //
6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7 | // 이러한 변경 내용이 손실됩니다.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
17 | ///
18 | // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
19 | // 클래스에서 자동으로 생성되었습니다.
20 | // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
21 | // ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("csharp_test_client.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해
56 | /// 현재 스레드의 CurrentUICulture 속성을 재정의합니다.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace csharp_test_client.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/exampleCodes/csharp_test_client/csharp_test_client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_test_client", "csharp_test_client.csproj", "{9E4B5E72-4E76-4E22-90B0-E53275A99018}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9E4B5E72-4E76-4E22-90B0-E53275A99018}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------