Changeset 840:b45e02ef8f29 in roaraudio for libroar/socket.c
- Timestamp:
- 09/27/08 03:36:43 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/socket.c
r839 r840 812 812 char cmd[1024] = {0}, rcmd[1024] = {0}; 813 813 int proxy_port = 22; 814 int use_socat = 0; 814 815 int r; 815 816 int socks[2]; … … 819 820 820 821 if ( *host == '/' ) 821 return -1;822 use_socat = 1; 822 823 823 824 if ( mode == MODE_LISTEN ) … … 826 827 if ( proxy_addr == NULL ) 827 828 return -1; 829 830 if ( opts != NULL ) { 831 if ( !strcmp(opts, "socat") ) { 832 use_socat = 1; 833 } else if ( !strcmp(opts, "netcat") ) { 834 use_socat = 0; 835 } else { 836 return -1; 837 } 838 } 828 839 829 840 if ( (sep = strstr(proxy_addr, "@")) != NULL ) … … 839 850 strcpy(rcmd, "roard --no-listen --client-fh 0"); 840 851 } else { 841 snprintf(rcmd, 1023, "$(which netcat nc 2> /dev/null | grep -v \" \" | head -n 1) \"%s\" %i", host, port); 852 if ( use_socat ) { 853 if ( *host == '/' ) { 854 snprintf(rcmd, 1023, "socat stdio unix-connect:\"%s\"", host); 855 } else { 856 snprintf(rcmd, 1023, "socat stdio tcp:\"%s\":%i", host, port); 857 } 858 } else { 859 snprintf(rcmd, 1023, "$(which netcat nc 2> /dev/null | grep -v \" \" | head -n 1) \"%s\" %i", host, port); 860 } 861 842 862 rcmd[1023] = 0; 843 863 }
Note: See TracChangeset
for help on using the changeset viewer.