Real Software Forums
http://forums.realsoftware.com/

problem with cocoa target and ServerSocket
http://forums.realsoftware.com/viewtopic.php?f=7&t=46405
Page 1 of 1

Author:  wakatanka [ Tue Jan 01, 2013 6:21 am ]
Post subject:  problem with cocoa target and ServerSocket

Hi, i've made a simple app to talk with my asterisk PBX.
The app has a ServerSocket that listen on a tcp port, waiting for calling by my CRM (so from my customers data i can
place directly the call on the ip phone).
The app has no windows, but only a menu icon on the top bar (like dropbox,volume control and so on), build with MBS NSstatusitem plugins)
It works flawless with carbon target, instead, on the cocoa side, it doesn't listen until i click on the app and get it frontmost in some way, then it
works as aspected.

any suggestion?

i don't know what type of testing i can make to find the problem.

Author:  Tiberius [ Sun Jan 27, 2013 8:54 am ]
Post subject:  Re: problem with cocoa target and ServerSocket

Hi,

Try to poll your socket in a timer.

See viewtopic.php?f=7&t=44884

Author:  Valdo [ Mon Jan 28, 2013 2:44 am ]
Post subject:  Re: problem with cocoa target and ServerSocket

Have you try put it in a thread ?

Author:  J.Sh3ppard [ Mon Jan 28, 2013 12:56 pm ]
Post subject:  Re: problem with cocoa target and ServerSocket

Hi guys.

This seems to be a big Cocoa socketcore bug. I tested this using TCPsockets (not a serversocket as the OP in this thread and not an IPCsocket as the OP in the other linked thread).

Polling does seem to solve it (I just tested) but as the other poster in the other thread said it does induce a CPU hit.

Before polling your socket from the timer remember to check that it doesn't = nil.
Otherwise noobies may be scratching their heads as to why they're getting nil object exception errors.

If Window1.Cocoa_Listensocket<>nil then
Window1.Cocoa_Listensocket.poll
end


Has anyone filed a bug report?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/