Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Sockets/D/sockets.d
Normal file
15
Task/Sockets/D/sockets.d
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module socket ;
|
||||
import std.stdio ;
|
||||
import std.socket ;
|
||||
version(Win32) {
|
||||
// For Win32 systems, need to link with ws2_32.lib.
|
||||
pragma(lib, "ws2_32.lib") ;
|
||||
}
|
||||
void main() {
|
||||
long res;
|
||||
auto socket = new Socket(AddressFamily.INET, SocketType.STREAM) ;
|
||||
socket.connect(new InternetAddress("localhost",256)) ;
|
||||
res = socket.send(cast(void[])"hello socket world") ;
|
||||
writefln("Socket %d bytes sent.", res) ;
|
||||
socket.close() ;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue