Rev | Line | |
---|
[6] | 1 | // LocalProxy.cpp : ÄÜ¼Ö ÀÀ¿ë ÇÁ·Î±×·¥¿¡ ´ëÇÑ ÁøÀÔÁ¡À» Á¤ÀÇÇÕ´Ï´Ù.
|
---|
| 2 | //
|
---|
| 3 |
|
---|
| 4 | #ifdef _WIN32
|
---|
| 5 | # define _CRT_SECURE_NO_WARNINGS
|
---|
| 6 | #endif
|
---|
| 7 |
|
---|
| 8 | #include "CRXSocket.h"
|
---|
[18] | 9 | #include "CRXProxy.h"
|
---|
[6] | 10 |
|
---|
| 11 | #include <iostream>
|
---|
| 12 | #include <iomanip>
|
---|
| 13 | #include <sstream>
|
---|
| 14 |
|
---|
| 15 | #include <stdio.h>
|
---|
| 16 | #include <string.h>
|
---|
| 17 |
|
---|
| 18 | using namespace std;
|
---|
| 19 |
|
---|
| 20 | int main (int argc, char* argv[])
|
---|
| 21 | {
|
---|
[14] | 22 | int aResult = 0;
|
---|
| 23 | const unsigned short aPort = 8080;
|
---|
[6] | 24 |
|
---|
[18] | 25 | CRXSocket aSocket;
|
---|
| 26 | CRXProxy * aProxy = NULL;
|
---|
[6] | 27 |
|
---|
| 28 | /*----------------------------------------------------------------*/
|
---|
| 29 | /*----------------------------------------------------------------
|
---|
| 30 | * Initialize
|
---|
| 31 | *----------------------------------------------------------------*/
|
---|
| 32 | aResult = aSocket.CreateServer (aPort);
|
---|
[21] | 33 | cout << "Failed to CreateServer." << endl;
|
---|
[6] | 34 | if (aResult < 0)
|
---|
| 35 | {
|
---|
| 36 | return aResult;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | for (;;)
|
---|
| 40 | {
|
---|
| 41 | aResult = aSocket.Accept ();
|
---|
| 42 | if (aResult < 0)
|
---|
| 43 | {
|
---|
[21] | 44 | cout << "Failed to Accept." << endl;
|
---|
[6] | 45 | break;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[20] | 48 | if ((aProxy = CRXProxy::GetNewInstance (aResult)) == NULL)
|
---|
[6] | 49 | {
|
---|
| 50 | aResult = -1;
|
---|
| 51 | break;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
[18] | 54 | aResult = aProxy->ForwardMT ();
|
---|
[6] | 55 | if (aResult < 0)
|
---|
| 56 | {
|
---|
[21] | 57 | cout << "Failed to forward." << endl;
|
---|
[6] | 58 | break;
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | /*----------------------------------------------------------------*/
|
---|
| 63 | aSocket.Close ();
|
---|
| 64 |
|
---|
| 65 | return aResult;
|
---|
[18] | 66 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.