Ticket #15188 (closed defect: fixed)
serial port using tcp socket does not work in Windows host
|Reported by:||dldall||Owned by:|
VirtualBox can not create socket for uart in windows 7 32 bit host.
00:00:02.068779 Serial#0: emulating 16550A 00:00:02.068835 VMSetError: F:\tinderbox\win-5.0\src\VBox\Devices\Serial\DrvTCP.cpp(389) int __cdecl drvTCPConstruct(struct PDMDRVINS *,struct CFGMNODE *,unsigned int); rc=VINF_SUCCESS 00:00:02.068838 VMSetError: DrvTCP#0 failed to create socket
the appropriate src file
/* * Create/Open the socket. */ int s = socket(PF_INET, SOCK_STREAM, 0); if (s == -1) return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS, N_("DrvTCP#%d failed to create socket"), pDrvIns->iInstance);
I have never seen socket(...) failed before and do not know the error source.
-) According MSDN you should not use "-1" in comparison, but rather defined constant INVALID_SOCKET (must not affect)
-) You should use WSAGetLastError instead of errno to get occured error description (winsock is not posix maybe)
-) You should not use 0 as protocol, but IPPROTO_TCP (must not affect)
-) You do wrong thread creation under Windows (runtime win library is not ready to accept new thread)
-) You do wrong import of std Windows functions, that are absent in real windows systems or your compiler has wrong socket implementation for windows.
I have no ideas how to solve the bug, but with the error it is impossible to use several uarts under windows host (single uart on single VM can be used with vmwaregateway tool).
As fast solution in other way than socket, there is vmwaregateway tool for TCP<->pipe bridge, if you can create the same tool with parameters (pipe_name, TCP_port); the uarts could be accessed via pipes.
more similar reports details listed in common forum topic