36 fprintf(stderr,
"Sockets_Test is portnum\n");
37 fprintf(stderr,
"Sockets_Test ic portnum hostname\n");
38 fprintf(stderr,
"Sockets_Test us pathname\n");
39 fprintf(stderr,
"Sockets_Test uc pathname\n");
43 int main(
int argc,
char * argv[])
57 if(strncmp(argv[1],
"is", 2) == 0) {
59 portnum = atoi(argv[2]);
62 while(con_count < 20) {
69 while((rsize = s->
get(buf, 1024)) >= 0) {
77 const char * okmsg =
"ok!";
78 std::cout <<
"message: [" << buf <<
"] length = " << rsize << std::endl;
79 std::cout <<
"iter_count = " << iter_count
80 <<
" empty_count = " << empty_count
81 <<
" found_count = " << found_count
82 <<
" con_count = " << con_count
85 std::cout <<
"Hmmmm>" << std::endl;
88 perror(
"Hmmm... get returned a negative result.");
92 std::cout <<
"FINAL iter_count = " << iter_count
93 <<
" empty_count = " << empty_count
94 <<
" found_count = " << found_count
98 else if (strncmp(argv[1],
"ic", 2) == 0) {
99 portnum = atoi(argv[2]);
101 const char * msg1 =
"SET RX_IF_FREQ D 110e3\n";
102 const char * msg2 =
"SET STOP I 2\n";
104 c->
put(msg1, strlen(msg1)+1);
105 c->
put(msg2, strlen(msg2)+1);
107 while((rs = c->
get(buf, 1024)) <= 0) {
108 std::cout <<
"waiting" << std::endl ;
112 std::cout <<
"message: [" << buf <<
"] length = " << rs << std::endl;
114 std::cout <<
"message: [" << buf <<
"] length = " << rs << std::endl;
117 else if(strncmp(argv[1],
"us", 2) == 0) {
121 while(con_count < 20) {
122 us->
put(
"Hey there sailor\n\n\n", 17);
126 std::cerr <<
"About to get buffer\n";
130 while((rsize = us->
get(buf, 1024)) >= 0) {
134 std::cerr <<
"socket no longer ready\n";
139 if((empty_count % 256) == 0) std::cerr <<
"Empty buffer\n";
143 const char * okmsg =
"ok!";
144 std::cout <<
"message: [" << buf <<
"] length = " << rsize << std::endl;
145 std::cout <<
"iter_count = " << iter_count
146 <<
" empty_count = " << empty_count
147 <<
" found_count = " << found_count
148 <<
" con_count = " << con_count
151 std::cout <<
"Hmmmm>" << std::endl;
154 perror(
"Hmmm... get returned a negative result.");
158 std::cout <<
"FINAL iter_count = " << iter_count
159 <<
" empty_count = " << empty_count
160 <<
" found_count = " << found_count
164 else if (strncmp(argv[1],
"uc", 2) == 0) {
166 const char * msg1 =
"SET RX_IF_FREQ D 110e3\n";
167 const char * msg2 =
"SET STOP I 2\n";
169 uc->
put(msg1, strlen(msg1)+1);
170 uc->
put(msg2, strlen(msg2)+1);
172 while((rs = uc->
get(buf, 1024)) <= 0) {
173 std::cout <<
"waiting" << std::endl ;
177 std::cout <<
"message: [" << buf <<
"] length = " << rs << std::endl;
179 std::cout <<
"message: [" << buf <<
"] length = " << rs << std::endl;
int get(void *ptr, unsigned int size)
int put(const void *ptr, unsigned int size)
int put(const void *ptr, unsigned int size)
int main(int argc, char *argv[])
int put(const void *ptr, unsigned int size)
int get(void *ptr, unsigned int size)
int get(void *ptr, unsigned int size)
int get(void *ptr, unsigned int size)
int put(const void *ptr, unsigned int size)