Announcement

Collapse
No announcement yet.

TCP Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TCP Help

    I seem to be having a bit of a problem. When I'm connected
    to the internet, my computer has about 3 IP addresses. I'm trying
    to write a server and only the second IP address can be used
    (The one that was assigned to me by my ISP).

    I use:

    TCP OPEN SERVER PORT %PORT AS SocketHandle

    The problem is that using the command above, opens the
    server using the first IP address, I've done a couple of test,
    and the first IP is only accessible from the local computer. I'm
    guessing it's my IP for a home network or something (Although, I
    don't have a home network).

    ------------------

  • #2
    Lloyd,

    Try this:

    Code:
    LOCAL ip AS LONG
          HOST ADDR "127.0.0.1" TO ip 'this is the ip to bind to!
          TCP OPEN SERVER ADDR ip PORT %PORT AS SocketHandle


    - Nathan.

    Comment


    • #3
      To clarify the syntax of the TCP OPEN statement a little for you:
      Code:
      As a client:
      TCP OPEN {PORT p& | srvc$} AT host$ AS [#] fnum& [TIMEOUT timeoutval&]
      
      As a Server:
      TCP OPEN SERVER [ADDR ip&] {PORT p& | srvc$} AS [#] fnum& [TIMEOUT timeoutval&]
      Also, timeoutval& is specified in seconds (contrary to what the help file says).

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment

      Working...
      X