Last change
on this file since 369:01c814f9b114 was
4:c53dd76646d3,
checked in by phi, 16 years ago
|
added roarsockconnect - simple connection tool like netcat but not real bi-dir
|
File size:
589 bytes
|
Rev | Line | |
---|
[4] | 1 | //roarsockconnect.c: |
---|
| 2 | |
---|
| 3 | #include <roaraudio.h> |
---|
| 4 | #include <string.h> |
---|
| 5 | #include <stdio.h> |
---|
| 6 | |
---|
| 7 | void usage (void) { |
---|
| 8 | fprintf(stderr, "Usage: roarsockconnect HOST PORT\n"); |
---|
| 9 | |
---|
| 10 | exit(1); |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | int main (int argc, char * argv[]) { |
---|
| 14 | char buf[1024]; |
---|
| 15 | int fh; |
---|
| 16 | int port; |
---|
| 17 | int len; |
---|
| 18 | |
---|
| 19 | if ( argc != 3 ) |
---|
| 20 | usage(); |
---|
| 21 | |
---|
| 22 | port = atoi(argv[2]); |
---|
| 23 | |
---|
| 24 | if ( (fh = roar_socket_connect(argv[1], port)) == -1 ) { |
---|
| 25 | ROAR_ERR("Error: can not connect!"); |
---|
| 26 | return 1; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | while ((len = read(ROAR_STDIN, buf, 1024))) |
---|
| 30 | write(fh, buf, len); |
---|
| 31 | |
---|
| 32 | while ((len = read(fh, buf, 1024))) |
---|
| 33 | write(ROAR_STDOUT, buf, len); |
---|
| 34 | |
---|
| 35 | return 0; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | //ll |
---|
Note: See
TracBrowser
for help on using the repository browser.