home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ Games Programming
/
CPPGAMES.ISO
/
thx
/
source
/
theatrix
/
netsrvr.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-04
|
861b
|
47 lines
#include <iostream.h>
#include "handler.h"
#include "serial.h"
#include "netfold.h"
#include "netsrvr.h"
void NetpackServer::startup()
{
CommParameters cp={ port,0,1,8,2400 };
if (netpacks_active)
{
commport=new CommPort(cp);
while (commport->input_char_ready())
commport->readcomm();
cout << "NETSRVR: using port " << port << "...\n";
}
}
void NetpackServer::check(Folder& fld)
{
if (commport)
{
if (commport->input_char_ready())
{
int p=commport->readcomm();
if (p >= 0 && p < MAXNETPACK)
fld.dispatch(p);
}
}
}
void NetpackServer::send(int p)
{
if (commport)
commport->writecomm(p);
}
void NetpackServer::shutdown()
{
if (commport)
{
delete commport;
cout << "NETSRVR: broke connection...\n";
}
}