sending mpz_t over tcp network

Décio Luiz Gazzoni Filho decio at decpp.net
Fri Apr 7 23:22:48 CEST 2006


On Apr 7, 2006, at 6:06 PM, Veress Krisztián wrote:

> Dear gmp users,
>
> I would like to send an alone mpz_t integer over tcp/ip from a server
> towards a client, but on the client side I'm always reading 1 bytes,
> when I'm sending 15 bytes on the server side.(I get these numbers from
> recv and send.)
> Could anyone tell me where I am wrong in the C code below, or an
> alternate solution?
> I probed to convert mpz_t to string, and send this one, but the same.

Your code is too long and complex to ask of list members to figure  
out what it does, particularly with comments in a foreign language.  
But it seems you're just sending an mpz_t struct over the network. An  
mpz_t struct is just a handle; what you're doing is equivalent to  
sending a pointer to a string instead of the string itself and expect  
the other side to be able to read it. So due to this alone your code  
won't work.

That's assuming your network code is correct, which I believe, from  
your description of the problem, that it isn't. Obviously, if that's  
the case, then this isn't the list to ask for help. You could begin  
by validating your client on simple ASCII inputs and then proceeding  
to send mpz_t values.

Décio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://gmplib.org/list-archives/gmp-discuss/attachments/20060407/c2d34947/PGP.bin


More information about the gmp-discuss mailing list