serverSocket only working in console mode

I can’t, for the life of me, get a serverSocket class to fire its ‘AddSocket’ event under a Windows application. Works fine if I add the class and reference an EasyTCPSocket class via Console mode. Anybody else having this issue? I can provide more information if needed.

Are you calling the listen() method on your server socket?

Yes I am. Here’s what I have constructed in the Windows Application:

  1. Added a class named ‘socketController’ w/ Super as ‘serverSocket’.
  2. Added a class named ‘socketTcp’ w/ Super as ‘easyTcpSocket’.
  3. Under the ‘Action’ event of a button on the main window I have the following:

[code]dim testTcp as new socketController

testTcp.port = 8200
testTcp.minimumSocketsAvailable = 2
testTcp.maximumSocketsAvailable = 1024

  1. Under the ‘AddSocket’ event of ‘socketController’ I have the following:

[code]dim targetSocket as new socketTcp

system.debugLog(“event fired”)

return targetSocket[/code]

Nothing happens, and the debug log doesn’t report the ‘event fired’ output in a Window Application; however, works fine in a console app.

Scope. Your testTcp is going out of scope as soon as the action event of your button on the main window exits.

i.e., make your testTCP a property that sticks around longer than just the body of that action. Where you stick it will depend on how long you need it, what needs access to it, etc.

Haha… that’s exactly what it was. :stuck_out_tongue: I feel dumbed-down about 10 levels now, and highly appreciate the reply. Worked!

Glad I could help! :slight_smile: