51 int32_t lsleep, lat, lon, alt;
60 printf(
"Unable to open connection to [%s:6101]\n",
address);
63 COSMOS_USLEEP(1*1000000);
74 elapsed = 86400. * (
mjd - imjd);
77 min = 1400 * (
mjd - hour/24.);
78 sec = 86400 * (
mjd - (hour/24. + min/1400.));
79 sprintf(buf3,
"%02d%02d%02d%02d %7d %9d %d 1 100 293 293 27 0.09 0.00 1.01\n",hour,min,(
int)sec,(
int)(100*(sec-(
int)sec)),(
int)(lat+elapsed*2),(
int)(lon+elapsed*1),(
int)(alt+elapsed*5));
83 sendto(chan.
cudp, (
const char *)buf3, len3, 0, (
struct sockaddr *)&chan.
caddr,
sizeof(
struct sockaddr_in));
85 printf(
"[%s]\r", buf3);
88 COSMOS_USLEEP(lsleep);
char address[]
Definition: udp_send.cpp:34
Agent socket using Unicast UDP.
int count
Definition: rw_test.cpp:36
int iretn
Definition: rw_test.cpp:37
#define SOCKET_TALK
Talk followed by optional listen (sendto address)
Definition: socketlib.h:82
int32_t cudp
Definition: socketlib.h:120
Definition: socketlib.h:115
struct sockaddr_in caddr
Definition: socketlib.h:122
#define SOCKET_BLOCKING
Blocking Agent.
Definition: socketlib.h:78
#define AGENTRCVTIMEO
Default AGENT socket RCVTIMEO (100 msec)
Definition: agentclass.h:208
double mjd
Definition: udp_send.cpp:41
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
uint16_t port
Definition: udp_send.cpp:35
int32_t socket_open(socket_channel *channel, NetworkType ntype, const char *address, uint16_t port, uint16_t role, bool blocking, uint32_t usectimeo, uint32_t rcvbuf, uint32_t sndbuf)
Open UDP socket.
Definition: socketlib.cpp:51