Sockets: accessing events - Help! 
Author Message
 Sockets: accessing events - Help!

Hi,

I have been working with sockets and thought I had understood the
concept, but one thing has me stumped (well, two really).

Firstly, I have made my own very simple HTTP socket class. The data (web
page) is returned by a new event in this class called, "Finished" using
it's parameter "text".

If I drag this class to a window I can access the returned data in it's
"finished" event in the IDE. eg: editfield.text = text. This works
flawlessly... I geddit :)

However, if I instantiate the class in code...
eg:
dim sk as MyHTTPSocket
sk = new MyHTTPSocket

...  how do I access sk's "finished" event as I can't see it in the IDE,
where is it? At this point I am puzzled :(

Addendum question:
Is there anyway to set this socket up to return it's collected data so I
could use this code: s = MyHTTPSocket(host,path) with using socket.poll

If anyone could answer/explain these I would be very grateful

TIA
Steve
email: steve (AT) passwordsafe.com



Wed, 22 Jan 2003 03:00:00 GMT  
 Sockets: accessing events - Help!
Oops!

The addendum question should be WITHOUT using socket.poll :)

Steve



Wed, 22 Jan 2003 03:00:00 GMT  
 Sockets: accessing events - Help!

Quote:

> I have been working with sockets and thought I had understood the
> concept, but one thing has me stumped (well, two really).

> Firstly, I have made my own very simple HTTP socket class. The data (web
> page) is returned by a new event in this class called, "Finished" using
> it's parameter "text".

> If I drag this class to a window I can access the returned data in it's
> "finished" event in the IDE. eg: editfield.text = text. This works
> flawlessly... I geddit :)

> However, if I instantiate the class in code...
> eg:
> dim sk as MyHTTPSocket
> sk = new MyHTTPSocket

> ...  how do I access sk's "finished" event as I can't see it in the IDE,
> where is it? At this point I am puzzled :(

Try making another class and set its super to MyHTTPSocket.  Now in that
class you should be able to see your events.  Place your code in there
that you want and when you go to create a new socket create that class.  
For example:

Create new class called "HTTPSocketClass" with a super of
"MyHTTPSocket".  Now when you want to create a new socket do the
following:

dim s as HTTPSocketClass
s = new HTTPSocketClass

I may have misunderstood your question so if this has absolutely nothing
to do with what you just asked... sorry  ;)

Hope this does help.
Mike



Fri, 31 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing NNTP servers via socket: Help!

2. Socket Help "Socket Newbie"

3. Socket events im PyTix mainloop()

4. Event processing while socket connecting

5. Problem/Bug?: sockets and file events

6. missing file events on server socket under Windows

7. tk Socket for events

8. Tk Socket for events

9. Question about Event processing and sockets

10. Event driven socket i/o?

11. UDP sockets, stopping events

12. event-driven socket i/o in tk4.1b1

 

 
Powered by phpBB® Forum Software