Evert Lammerts wrote:
> Hi,
> 
> I have two kernel modules, one for sending and one for recieving, on two
> different machines. The two interesting functions, after creating the
> sockets and connecting to them, are basically:
> 
> static void recieve(void *arg)
> {
>   int retval;
>   char packet[sizeof(float)];
> 
>   retval = rt_dev_recv(sockfd, packet, sizeof(packet), 0);
> 
>   *((hal_float_t *)hal_data->hfloat) = *((float *)packet);
> }
> 
> static void send(void *arg, long period)
> {
>   int retval;
> 
>   char packet[] = "2.9";

Looks to me like you are sending the *string* "2.9" here, no?

> 
>   retval = rt_dev_send(sockfd, packet, sizeof(packet), 0);
> }
> 
> In recieve, hal_float_t is a volatile float.
> 
> First off, is it true that I can only send a char array? Or could I send
> over a float directely?

You can do this, or you can wrap some structure around it, or... The
only thing you have to care for is if do both machines store float
identically in memory: number and meaning of bits, byte order
(big/little endian).

> 
> If I now monitor the value of hal_data->hal_float, I get a strange value.
> I know I'm doing something wrong here on programming level, probably in
> casting. Any idea what that might be?
> 
> Thanks a bunch,
> Evert
> 
> 

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to