I’m trying to send a scalar value over socket which I have got with nfreeze from storable.
Step by step:
- I get the scalar
$serializedHash = nfreeze \%hash; - I want to send it over socket
$sendSocket->send($serializedHash);
This works fine, as long as the scalar $serializedHash is not bigger than 1024byte. Because I have on the other side a socket which can only receive data with max. length of 1024byte.
I also cannot store $serializedHash in a file and then handle it with sysread and syswrite.
What I don’t want is to send every single line per socket, bacause my Hash has over 2 million entries. The hash element are seperated by a \n so I tried with the split function, but then I have a array with 2 million entries.
How can I send data in packages through a UDP socket?
You may possibly process your serialized hash by chunks, like that: