LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you access a function from a winsock2.dll that has parameters with structures

Hi! I need to access winsock2 functions. The function that I need is bind, the prototype is:
int bind(SOCKET s, const struct sockaddr *name, int namelen);
The structure is
struct sockaddr {
u_short sa_family;
char sa_data[14];
};

And what I need to "translate" from C to Labview is

main ()
{ SOCKET s;

//some instructions

struct sockaddr name;
name.sa_family=AF_J1850;
strcpy(name.sa_data,"COM2");
bind (s, &name, 7);
//some extra code

I've been reading, and I think I must create a cluster, and the cluster will be the structure, but I'm not sure. So If someone can help me,I'd appreciated it!
Thanks
Catalina
0 Kudos
Message 1 of 3
(2,790 Views)
Check out this post .
0 Kudos
Message 2 of 3
(2,790 Views)
It is impossible to built a cluster that is similar to a struct. You can
have a lock
at the funny bullshut code that represets a cluster in when you wire a
cluster
into a CIN (Code interface node). you can input a byte array and format it
like
the struckt which is in fact the same - first struct element (bytesize)
first array element



"Catalina" wrote in message
news:50650000000800000020720000-1042324653000@exchange.ni.com...
> Hi! I need to access winsock2 functions. The function that I need is
> bind, the prototype is:
> int bind(SOCKET s, const struct sockaddr *name, int namelen);
> The structure is
> struct sockaddr {
> u_short sa_family;
> char sa_data[14];
> };
>
> And what I need to "translate" from
C to Labview is
>
> main ()
> { SOCKET s;
>
> //some instructions
>
> struct sockaddr name;
> name.sa_family=AF_J1850;
> strcpy(name.sa_data,"COM2");
> bind (s, &name, 7);
> //some extra code
>
> I've been reading, and I think I must create a cluster, and the
> cluster will be the structure, but I'm not sure. So If someone can
> help me,I'd appreciated it! Thanks
> Catalina
>
0 Kudos
Message 3 of 3
(2,790 Views)