OK Server question.
I open a port (37, time) and listen.
I expect that after a FD_ACCEPT occurs I will want to do FD_CONNECT, FD_WRITE, and then FD_CLOSE.
I can't seem to make it work however, maybe I don't understand.
The other thing to note is that running NETSTAT shows my server listening, and the client machine in a CLOSE_WAIT status, I'm not certain what that means just yet...

I understand that I say TCP xxxx, to %TCP_CONNECT and the message is passed, and it's up to me to take the message and interact with it, so this is what I have:


Code:
    Case %WM_INITDIALOG

      hSock = FreeFile
      Tcp Open Server Port Val(ListenPort) As hSock TIMEOUT 5
      PortOpened = %TRUE
      For x = 1 To %MAX_CONNECTIONS
         hConnSock(x) = %INVALID_SOCKET
      Next
      Tcp Notify hSock, ACCEPT To hDlg As %TCP_CONNECT
      Function = 1
      Exit Function 

     Case %TCP_CONNECT

      Select Case LoWrd(wParam)
             Case %FD_ACCEPT
               For x = 1 To %MAX_CONNECTIONS
                  If hConnSock(x) = %INVALID_SOCKET Then       'Verify nobody else is connected here
                    hConnSock(x) = FreeFile
                    Tcp Accept hSock As hConnSock(x)
'                    Tcp Notify hConnSock(x),Close To hDlg As %TCP_CONNECT
                    Tcp Notify hConnSock(x), Send Close To hDlg As %TCP_CONNECT
                  End If
               Next x

            Case %FD_READ
            Case %FD_WRITE
               For x = 1 To %MAX_CONNECTIONS
                  If FileAttr(hConnSock(x), 2) = CbWparam Then
                      Select Case Emulate
                            Case 1,3
                             Tcp Send hConnSock(x), FormatOutput(Emulate)
                            Case 2
                             Tcp Send hSock, Str$(Int(RFC868Time))
                      End Select
                      Tcp Notify hConnSock(x), Close To hDlg As %TCP_CONNECT
                      Exit For
                  End If
               Next x
               Function = 1
               Exit Function

            Case %FD_CONNECT
'               For x = 1 To %MAX_CONNECTIONS
'               Next x
               Function = 1
               Exit Function

            Case %FD_CLOSE
              Tcp Close hConnSock(x)
              hConnSock(x) = %INVALID_SOCKET
              Statistics.LanHits = Statistics.LanHits + 1
              Control Set Text hDlg, %ID_LABEL3, Trim$(Str$(Statistics.LanHits))

[This message has been edited by Scott Turchin (edited January 05, 2000).]