-
Notifications
You must be signed in to change notification settings - Fork 0
/
NrServerMain.cpp
65 lines (53 loc) · 1.33 KB
/
NrServerMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* file: NrServerMain.cpp
*
* This file is part of the NetStreamer software. This file is distributed
* under the GNU GENERAL PUBLIC LICENSE, see the accompanying COPYING file.
*
* Copyright (C) 1997 Rolf Fokkens
*
*/
#include <malloc.h>
#include <iostream>
#include "XxSocket.h"
#include "NrServer.h"
using namespace std;
static void ShowArgErrorMessage (EzString ProgName)
{
cerr
<< "Bad parameters\n"
<< "Usage:" << endl
<< " " << ProgName << " ServerAddr\n"
<< "Where:\n"
<< " ServerAddr : [IpAddr]:Port of a server\n"
<< " e.g. :8888\n";
};
static void CreateListener (EzString AddrPort)
{
NrServerListener *pListener;
pListener = new NrServerListener;
if (!pListener->Listen (AddrPort)) {
cerr << "Cannot listen on " << AddrPort << endl;
delete pListener;
};
};
int main (int argc, char *argv[])
{
/*
NrServerListener TestListener;
XxConnection *pConnection;
XxBlocker *pBlocker;
XxBlocker::XxAction Action;
struct mallinfo MallInfo;
int mSec;
*/
NrServerListener *pListener;
EzString AddrPort;
int i;
for (i = 1; i < (argc > 1 ? argc : 2); i++) {
AddrPort = (i < argc ? argv [i] : ":8888");
CreateListener (AddrPort);
};
XxBlocker::MainLoop ();
return 0;
};