I'm trying to send data from python script to D using tcp sockets. As I'm new to D I referred to https://forum.dlang.org/post/lqahvaeqddaddnkhpfyf@forum.dlang.org for client and server code. When I'm sending packed data from python it is of the form
u'\x0f\x10\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\xbaH\x0c\x00'
basically a string! This data is successfully received on the client side in D but when the data is changing to
u'\x0f\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00'
I'm receiving nothing on the client-side in D.
Client code:
void main() {
import std.socket, std.stdio;
auto socket = new Socket(AddressFamily.INET, SocketType.STREAM);
char[1024] buffer;
socket.connect(new InternetAddress("127.0.0.1", 10000));
auto received = socket.receive(buffer); // wait for the server to say hello
writeln("Server said: ", buffer[0 .. received]);
}
(same code as mentioned in the above link)
Can someone please help me with this?
Also when I'm sending the data in the 1st format, I'm receiving �H
as an output on the client, what changes in code should I make so that I receive the data in the same format as sent from Python?