Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Aug 17, 2019 6:32 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Socket hand-off.
PostPosted: Wed Jul 27, 2011 5:14 am 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Hello

I already tried to migrate my project with the program Realsoftware provides. But I got no succes, I just got no Window.

So, What I do in my VB6 app:

On program load: Create an array of Sockets.
The first socket of the array listens to connections, if some connection is made, the requestID is given to another socket, and the first socket keeps listening. This is done this way:

For intteller = 1 To Aantalsocks
If winsck(intteller).State = sckClosed Then
winsck(intteller).Accept requestID
Exit For
End If
Next


I would like to accomplish this within RS, without using the serversocket class. (Personal vs professional license)

I really hope anybody can help, I have no idea how to hand of the connection to another socket in an array.

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Wed Jul 27, 2011 12:19 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Carharttguy wrote:
Hello

I already tried to migrate my project with the program Realsoftware provides. But I got no succes, I just got no Window.

So, What I do in my VB6 app:

On program load: Create an array of Sockets.
The first socket of the array listens to connections, if some connection is made, the requestID is given to another socket, and the first socket keeps listening. This is done this way:

For intteller = 1 To Aantalsocks
If winsck(intteller).State = sckClosed Then
winsck(intteller).Accept requestID
Exit For
End If
Next


I would like to accomplish this within RS, without using the serversocket class. (Personal vs professional license)

I really hope anybody can help, I have no idea how to hand of the connection to another socket in an array.


it might not be the best option but if you create a subclass wich handles sockets in an array where the main (sub)class is the listening part and childs are held within this class handle the connection further...

I will try to sample this for you and send the project.

Regards,
SWORT

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Thu Jul 28, 2011 3:56 am 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Thank you. (Sorry i'm a RB-noob :) )

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Thu Jul 28, 2011 6:12 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Carharttguy wrote:
Thank you. (Sorry i'm a RB-noob :) )


my test is showing that it's pretty difficult.

How it worked:
- Subclass made of TCPSocket named "ServerTCPSocket"
- Added a few events and one array (of current clients as TCPSocket)
- Made methods to listen automaticly.
- After one new client is connected to the "ServerTCPSocket" on the same port, the server creates a new tcpsocket (client) and adds it to the array. However this can only be done if you app (the client) had a listener and sender. Where the sender tries to make the connection which will be dropped and later to be picked up by the listener (client).

The client should look like this:
- 1x TCPSocket to listen (to read/write from)
- 1x TCPSocket to send (and begin the whole connection, just an activator)

The server should look like this:
- 1x ServerTCPSocket which will handle the clients and listen for connections. After connection it creates a new client in the array and disconnects the current connection (which it got while listening) just to reconnect trough the client.

It seems a bit weird and far away from the ServerSocket itself...

Perhaps i can find another way for you, any help by anyone is apreciated!

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Fri Jul 29, 2011 10:22 am 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Hmh, not that easy.

I was thinking, what If I do the following:

-create socket and listen
-If socket got connection
-create new socket and set that new socket to listen state

But I don't know how to public declare a new socket, If I use 'public', It won't work, If I use 'dim', I can use it, but i'm pretty sure the scope of 'dim' declared objects is not public?
And even putting it in an array is a bit out of my range, darn, VB6 and RB really look the same!

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Fri Jul 29, 2011 1:11 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Carharttguy wrote:
Hmh, not that easy.

I was thinking, what If I do the following:

-create socket and listen
-If socket got connection
-create new socket and set that new socket to listen state

But I don't know how to public declare a new socket, If I use 'public', It won't work, If I use 'dim', I can use it, but i'm pretty sure the scope of 'dim' declared objects is not public?
And even putting it in an array is a bit out of my range, darn, VB6 and RB really look the same!


well that can be done, but the reference to your server (listen) socket will be gone as it changed into a client.
i'll try to build this into a class for you.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Socket hand-off.
PostPosted: Fri Aug 05, 2011 4:48 pm 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Oh ok.

Hmh really harder then it was back with VB6 :P
Think it's because i'm not that familiar with OOP...

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group