new:wq
This commit is contained in:
28
client/d/yadynd.d
Normal file
28
client/d/yadynd.d
Normal file
@ -0,0 +1,28 @@
|
||||
import std.stdio;
|
||||
import std.socket;
|
||||
import std.date;
|
||||
import std.string;
|
||||
import std.md5;
|
||||
|
||||
|
||||
void main() {
|
||||
const char[] DYN_ID = "omega";
|
||||
const char[] SHARED_SECRET = "0m3g@";
|
||||
|
||||
const char[] SERVER_IP = "88.198.170.2";
|
||||
const int SERVER_PORT = 8053;
|
||||
|
||||
|
||||
long time = getUTCtime() / TicksPerSecond;
|
||||
char[] data = format("%s %s %d", DYN_ID, SHARED_SECRET, time);
|
||||
|
||||
ubyte[16] checksum;
|
||||
sum(checksum, data);
|
||||
|
||||
char[] dataToSend = format("%s %d %s", DYN_ID, time, tolower(digestToString(checksum)));
|
||||
|
||||
Socket sock = new UdpSocket(AddressFamily.INET);
|
||||
InternetAddress serverAddress = new InternetAddress(SERVER_IP, SERVER_PORT);
|
||||
sock.sendTo(dataToSend, serverAddress);
|
||||
sock.close();
|
||||
}
|
Reference in New Issue
Block a user