Created
April 2, 2014 08:25
-
-
Save mplacona/9930121 to your computer and use it in GitHub Desktop.
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
import 'dart:io'; | |
import 'dart:async'; | |
final int port = 5000; | |
final String address = "127.0.0.1"; | |
void main() { | |
Future<ServerSocket> serverFuture = ServerSocket.bind(address, port); | |
serverFuture.then((ServerSocket server) { | |
print('listening for connections on ' + server.port.toString()); | |
server.listen((Socket socket) { | |
socket.listen((List<int> data) { | |
String cls = "Hi, I'm darty, your friendly little server"; | |
socket.write(cls); | |
socket.close(); | |
}); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment