-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
708ecdc
commit b9bc334
Showing
6 changed files
with
116 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-cp samples | ||
-cp .. | ||
|
||
--each | ||
|
||
-neko websocket.n | ||
-main websocket.Echo | ||
|
||
--next | ||
|
||
-neko telnet.n | ||
-main telnet.Echo | ||
|
||
--next | ||
|
||
-neko client.n | ||
-main telnet.Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package telnet; | ||
|
||
class Client extends hxnet.protocols.Telnet | ||
{ | ||
|
||
override private function lineReceived(line:String) | ||
{ | ||
trace(line); | ||
} | ||
|
||
static public function main() | ||
{ | ||
var client = new hxnet.tcp.Client(); | ||
client.protocol = new Client(); | ||
client.connect("localhost", 4000); | ||
|
||
while (true) | ||
{ | ||
// application logic | ||
client.update(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package telnet; | ||
|
||
class Echo extends hxnet.protocols.Telnet | ||
{ | ||
|
||
override private function lineReceived(line:String) | ||
{ | ||
writeLine(line); | ||
} | ||
|
||
static public function main() | ||
{ | ||
var server = new hxnet.tcp.Server(new hxnet.base.Factory(Echo), 4000, "localhost"); | ||
server.start(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
import hxnet.tcp.Server; | ||
package websocket; | ||
|
||
class Echo extends hxnet.protocols.WebSocket | ||
{ | ||
|
||
override private function recvText(text:String) { | ||
sendText(text); | ||
} | ||
|
||
override private function recvBinary(data:haxe.io.Bytes) { | ||
sendBinary(data); | ||
} | ||
} | ||
|
||
class Main | ||
{ | ||
|
||
public function new() | ||
{ | ||
server = new Server(new hxnet.base.Factory(Echo), 4000, "localhost"); | ||
server.listen(); | ||
while (true) | ||
{ | ||
server.update(); | ||
} | ||
} | ||
|
||
static public function main() | ||
{ | ||
new Main(); | ||
var server = new hxnet.tcp.Server(new hxnet.base.Factory(Echo), 4000, "localhost"); | ||
server.start(); | ||
} | ||
|
||
private var server:Server; | ||
} | ||
} |