MagicQ User Manual
237 / 348
\{
struct
sockaddr_in name;
char
opts[100];
socklen_t optlen = 100;
int
flags;
int
i;
// For Windows OS we need to start winsocket
#ifndef
LINUX
\{
WSAData ws;
int
code;
code = WSAStartup(MAKEWORD(1,1),&ws);
}
#endif
if
(remote_ether_sock)
\{
return
(TRUE);
}
remote_ether_sock = socket (PF_INET, SOCK_DGRAM, 0);
getsockopt (remote_ether_sock,SOL_SOCKET,SO_REUSEADDR, opts, &optlen);
opts[0] = 1;
setsockopt (remote_ether_sock,SOL_SOCKET,SO_REUSEADDR, opts, optlen);
/* Give the socket a name. */
name.sin_family = AF_INET;
name.sin_port = htons (REMOTE_ETHER_PORT);
name.sin_addr.s_addr = htonl (INADDR_ANY);
if
(bind (remote_ether_sock, (
struct
sockaddr *) &name,
sizeof
(name)) <
)
\{
closesocket(remote_ether_sock);
return
(FALSE);
}
getsockopt (remote_ether_sock,SOL_SOCKET,SO_BROADCAST, opts, &optlen);
opts[0] = 1;
setsockopt (remote_ether_sock,SOL_SOCKET,SO_BROADCAST, opts, optlen);
\{
u_long block;
block = 1;
ioctlsocket(remote_ether_sock,FIONBIO,&block);
}
return
TRUE;
}
int
remote_ether_rx(
char
*data, word16 size)
\{
char
message[MAX_CREP_MSG];
int
nbytes;
remote_ether_message_t *rem = (remote_ether_message_t *) message;
struct
sockaddr_in name;
int
name_len =
sizeof
(name);
if
(!remote_ether_sock)
return
(0);
nbytes = recvfrom (remote_ether_sock,
message,
MAX_CREP_MSG,
0,
(
struct
sockaddr *) &name,
&name_len);
if
(nbytes > 0)
\{
Содержание MagicQ Pro Series
Страница 2: ...MagicQ User Manual ii REVISION HISTORY NUMBER DATE DESCRIPTION NAME v1 6 6 9 06 03 2015 ChamSys...
Страница 38: ...MagicQ User Manual 9 348...
Страница 188: ...MagicQ User Manual 159 348...
Страница 207: ...MagicQ User Manual 178 348 3D FX A2 applies a trail to the particle as it moves...
Страница 210: ...MagicQ User Manual 181 348...