[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gmp-discuss
Subject:    sending mpz_t over tcp network
From:       decio () decpp ! net (=?ISO-8859-1?Q?D=E9cio_Luiz_Gazzoni_Filho?=)
Date:       2006-04-07 21:22:48
Message-ID: 8D93BB65-AEE3-45C2-BC39-41E3369CFF64 () decpp ! net
[Download RAW message or body]


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic