if(!gsVT_InputDevice) gsVT_InputDevice = (char*)DEFAULT_INPUT;
else if( Module_EnsureLoaded( gsVT_InputDevice ) ) gsVT_InputDevice = (char*)DEFAULT_INPUT;
- if( Module_EnsureLoaded( gsVT_OutputDevice ) ) {
+ if( Module_EnsureLoaded( gsVT_InputDevice ) ) {
Log_Error("VTerm", "Fallback input '%s' is not avaliable, input will not be avaliable", DEFAULT_INPUT);
}
int OpenTCP(const char *AddressString, short PortNumber)\r
{\r
int fd, addrType;\r
- char *iface;\r
char addrBuffer[8];\r
\r
// Parse IP Address\r
addrType = Net_ParseAddress(AddressString, addrBuffer);\r
if( addrType == 0 ) {\r
fprintf(stderr, "Unable to parse '%s' as an IP address\n", AddressString);\r
+ _SysDebug("Unable to parse '%s' as an IP address\n", AddressString);\r
return -1;\r
}\r
\r
// Finds the interface for the destination address\r
- iface = Net_GetInterface(addrType, addrBuffer);\r
- if( iface == NULL ) {\r
- fprintf(stderr, "Unable to find a route to '%s'\n", AddressString);\r
- return -1;\r
- }\r
- \r
-// printf("iface = '%s'\n", iface);\r
- \r
- // Open client socket\r
- // TODO: Move this out to libnet?\r
- {\r
- int len = snprintf(NULL, 100, "/Devices/ip/%s/tcpc", iface);\r
- char path[len+1];\r
- snprintf(path, 100, "/Devices/ip/%s/tcpc", iface);\r
- fd = open(path, OPENFLAG_READ|OPENFLAG_WRITE);\r
- }\r
- \r
- free(iface);\r
- \r
+ fd = Net_OpenSocket(addrType, addrBuffer, "tcpc");\r
if( fd == -1 ) {\r
- fprintf(stderr, "Unable to open TCP Client for reading\n");\r
+ fprintf(stderr, "Unable to open TCP Client to '%s'\n", AddressString);\r
+ _SysDebug("Unable to open TCP client to '%s'\n", AddressString);\r
return -1;\r
}\r
\r
* If NULL, the node directory is opened
* \return Socket file descriptor (as returned by \a open), or -1 on error
*
- * Opens a file using /Devices/ip/routes/<AddrType>:<Addr>/<SocketName>
+ * Opens a file using /Devices/ip/routes/@<AddrType>:<Addr>/<SocketName>
*
*/
extern int Net_OpenSocket(int AddrType, void *Addr, const char *SocketName);