New topic: 

How do I know if the port for TCPsocket test is open?

<http://forums.realsoftware.com/viewtopic.php?t=45895>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        kreed          Post subject: How do I know if the port for 
TCPsocket test is open?Posted: Tue Nov 13, 2012 4:36 pm                         
Joined: Fri Oct 12, 2012 1:18 pm
Posts: 3                I have set up a TCPsocket test using the example 
program from the online documentaton: Compiles ok. External test program 
attempts to send a packet to this program. He gets a timeout. I'M CONTINUALLY 
LOOPING AND NEVER SEE THE PING.

 QUESTION: HOW DO I KNOW THAT THE PORT I'VE CHOSEN IS OPEN? AND IF NOT, HOW DO 
I OPEN IT.

I'M USING MAC OS 7.4 LION.

  // InitTCPsocket
  // Author: Ken Reed
  // Date 11/13/12
  // Action: Sets up the TCPSocket as server for communication with the 
analytic components
  
  Dim start, stop As Integer
  Dim NNsocket As TCPSocket
  
  NNsocket = New TCPSocket
  
  //set port and address
  Address = " my ip here "
  NNsocket.Port = 7000
 
  MsgBox( "Beginning synchronous connection ... " )
  
  start = Ticks/60/60   //minutes
  while not NNsocket.IsConnected
  // check to see if the socket got an error
  if NNsocket.LastErrorCode <> 0 then
  MsgBox( "Socket Error: " + str( NNsocket.LastErrorCode ))
  Exit
  end if
  NNsocket.Poll
  Wend
  stop = Ticks/60/60
  
  //if we broke the loop because we're connected
  if NNsocket.IsConnected then
  MsgBox( "Socket Connected in " + Str( stop - start ) + " minutes" )
  Return true
  else
  //Socket broke loop because of an error
  MsgBox( "Socket failed to connect after " + Str( stop - start ) + " minutes" )
  Return false
  end if   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to