Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -0,0 +1,32 @@
|
|||
use System.IO.Net, Collection;
|
||||
|
||||
class DistPrgm {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
if(args->Size() = 1) {
|
||||
target := args[0];
|
||||
port := 8888;
|
||||
|
||||
if(target->Equals("client")) {
|
||||
DoClient(port);
|
||||
}
|
||||
else if(target->Equals("server")) {
|
||||
DoServer(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function : DoServer(port : Int) ~ Nil {
|
||||
server := TCPSocketServer->New(port);
|
||||
if(server->Listen(10)) {
|
||||
client := server->Accept();
|
||||
client->ReadLine()->PrintLine();
|
||||
client->Close();
|
||||
};
|
||||
}
|
||||
|
||||
function : DoClient(port : Int) ~ Nil {
|
||||
server := TCPSocket->New("localhost", port);
|
||||
server->WriteString("Hello World!\r\n");
|
||||
server->Close();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue