I'm trying to listen on a port, and be able to connect to that port from both a LAN-based workstation and an Internet-based workstation. At the moment I can only have one or the other...
Im binding a socket using this statement:
Where GetAdapter is this function (found somewhere in POFFS):
The problem:
When it binds to an adapter (eg. the same adapter that my modem/internet uses), only Internet-based sockets can connect to it... I can't telnet to the port from a different workstation in my LAN
If I change it to bind to adapter 1 instead of 0, it's the opposite - I can connect from my LAN, but not from the Internet...
I noticed that when I load a socket in Visual Basic, it seems to bind to _all_ adapters... so what do I have to do to create a socket that can be connected to from both the Internet _and_ my LAN?
Any help is much appreciated!
Thanks,
Wayne
------------------
Im binding a socket using this statement:
Code:
TCP OPEN Server ADDR GetAdapter PORT 113 AS hServer TIMEOUT 5
Code:
FUNCTION GetAdapter() AS LONG LOCAL sd AS DWORD LOCAL nBytesReturned AS DWORD LOCAL i AS LONG LOCAL lerr AS LONG LOCAL lReturn AS LONG LOCAL nNumInterfaces AS INTEGER LOCAL sDisplay AS STRING LOCAL sBuff AS STRING * 760 '' allow max 10 interfaces LOCAL pszHost AS ASCIIZ PTR sd = WSASocket(%AF_INET, %SOCK_DGRAM, 0, BYVAL 0, 0, 0) IF sd = %SOCKET_ERROR THEN EXIT FUNCTION lReturn = WSAIoctl(BYVAL sd, %SIO_GET_INTERFACE_LIST, 0, 0, VARPTR( sBuff ), _ LEN(sBuff), nBytesReturned, BYVAL 0, BYVAL 0 ) lerr = WSAGetLastError() IF lreturn = %SOCKET_ERROR THEN 'STDOUT "lReturn " + $TAB + STR$( lreturn ) + $CRLF + "lerr " + $TAB + STR$( lerr ) EXIT FUNCTION END IF closesocket sd WSACleanup DIM zz AS LONG FUNCTION = CVL(MID$(sBuff, %ADAPTER * %INTERFACE_RECLEN + 9, %IP_Len)) END FUNCTION
When it binds to an adapter (eg. the same adapter that my modem/internet uses), only Internet-based sockets can connect to it... I can't telnet to the port from a different workstation in my LAN
If I change it to bind to adapter 1 instead of 0, it's the opposite - I can connect from my LAN, but not from the Internet...
I noticed that when I load a socket in Visual Basic, it seems to bind to _all_ adapters... so what do I have to do to create a socket that can be connected to from both the Internet _and_ my LAN?
Any help is much appreciated!
Thanks,
Wayne
------------------
Comment