[Gambas-user] Multiple TCP server sockets

Benoît Minisini gambas at ...1...
Thu Feb 19 16:56:21 CET 2009


> On 2/17/09, Benoît Minisini <gambas at ...1...> wrote:
> > > Is there any way to get different TCP server objects with different
> > >
> >  > ports to use a different socket object for read?  I am trying to port
> >  > my VB6 multiport communications server application to Gambas2 and (I
> >  > think) I need something like that to get it to work.
> >  >
> >  > Regards,
> >  > Joe1962
> >
> > I would say yes. I see nothing that prevents from creating several
> >  SocketServer objects.
>
> That is not the issue, you can do that, but they all use the same
> socket_read sub. Or I my missing something here?
>
> Regards,
> Joe1962
>

Hem, you are right, I didn't notice.

Internallly the Socket object knows which ServerSocket created it, but you 
don't have any access to it!

As a workaround, I think you can use the port number to make the difference.

Maybe I will make a "Server" property in the Socket class to get the 
ServerSocket object creator.

And I can add an optional argument to the Accep() method to define the event 
name of the created socket.

Regards,

-- 
Benoît




More information about the User mailing list