[Gambas-user] Socket not working in 2.8
Ron
ron at ...1740...
Sun Oct 4 15:05:52 CEST 2009
nospam.nospam.nospam at ...626... wrote:
> On Sun, 2009-10-04 at 14:53 +0200, Ron wrote:
>
>> nospam.nospam.nospam at ...626... wrote:
>>
>>> On Sun, 2009-10-04 at 19:35 +0800, Werner wrote:
>>>
>>>
>>>> nospam.nospam.nospam at ...626... wrote:
>>>>
>>>>
>>>>> I tried to create an application using a Socket instantiated in code:
>>>>>
>>>>> [CODE]
>>>>> PRIVATE MySock AS Socket
>>>>>
>>>>> PUBLIC SUB Form_Open()
>>>>>
>>>>> MySock = NEW Socket
>>>>>
>>>>> END
>>>>> [/CODE]
>>>>>
>>>>> I also tried:
>>>>>
>>>>> [CODE]
>>>>> PRIVATE MySock AS NEW Socket
>>>>> [/CODE]
>>>>>
>>>>> I had endless trouble getting the Socket to work so I created a new
>>>>> project from the ClientSocket (0.0.56) sample included in 2.8. I first
>>>>> tested the sample app, which worked fine. I then deleted the Socket
>>>>> control from the sample and added the code as shown above.
>>>>>
>>>>> Lo and behold, the Socket, when instantiated in code, will not connect
>>>>> to anything. It just sits there "looking up hostname".
>>>>>
>>>>> I need to be able to use a Socket in a class module, but it seems the
>>>>> Socket doesn't want to work if it is instantiated in code. It works fine
>>>>> if the Socket is added to a form, but this is no good for what I need to
>>>>> achieve.
>>>>>
>>>>> Am I doing something wrong or could this be a bug in Socket?
>>>>>
>>>>> Any help is appreciated.
>>>>>
>>>>>
>>>>>
>>>> Dear Spam Spam Spam,
>>>>
>>>> do you actually try to establish a connection?
>>>> as in http://gambasdoc.org/help/comp/gb.net/socket
>>>>
>>>>
>>> Good grief. Did you actually try to understand what I wrote?
>>>
>>> I created a new project from the ClientSocket (0.0.56) sample included
>>> in 2.8. I first tested the sample app, which worked fine. I then deleted
>>> the Socket control from the sample and added the code as shown above.
>>>
>>> Lo and behold, the Socket, when instantiated in code, will not connect
>>> to anything. It just sits there "looking up hostname".
>>>
>>>
>>>
>> Before you start with comments again, your mail wasn't that clear as it
>> may seem.
>>
>> Did you add a name to the socket when creating it? Like so:
>>
>> hMySocket = NEW Socket AS "MySock"
>>
>> And then use event handlers with that name, like this?
>>
>> PUBLIC SUB MySock_Read()
>>
>> END
>>
>> Without it events will not work, and thus you cannot detect if it's
>> connecting or not.
>>
>
> "I created a new project from the ClientSocket (0.0.56) sample which
> worked fine."
>
> All of what you said is already in the sample. The sample does not work
> when the Socket is instantiated in code.
>
>
>> And version 2.8 is a bit old, tons of bug fixes since then (we are at
>> 2.17 now)
>>
>
> Right. I'll upgrade and try the same thing again. Thank you.
>
>
Oh my god, next time no answer from me then...
My project is using tons of sockets all created from code, and working
100% 24/7, so please calm down man.
http://domotiga.nl
Regards,
Ron_2nd.
More information about the User
mailing list