Real Software Forums

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

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ServerSocket communicating with individual connected clients
PostPosted: Sun May 20, 2012 5:15 am 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
Hi, All i hope that somebody will be kind enough to help as i am a complete Noobie to RB, Unemployed and on the verge of pulling my hair out... :lol:

Please see my uploaded realbasic project example here:

http://level101.herobo.com/rb/ClientServerExample.rar

The ServerSocket application's Event handler simply spawns an AddSocket/TCPSocket on receiving a connection from a client a displays the connected client in the ListView Box.

What i having trouble with is working out a method to write back to individual connected clients; I presume that i would need to create
and store an Array of some kind using ServerSocket.ActiveConnections maybe..?

Anyhow i am sure that the attached code example will be a useful addition for other "noobs" to learn from.

Thanks for you help

Lee


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Sun May 20, 2012 11:15 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
create a control tcpsocket array (set your tcpsocket index to 0) and on a new connection request, add one to the index and create the new tcpsocket connection...I would refrain from using a timer and listbox.deleteallrows as you'll get a lot of "flicker" once many clients are connected to the server. Instead add the client to the list when the connected event happens. In your timer, make an array of connected users and set the listbox row tag of the client added to the user's socket listbox by index...from there, use listcount and a for next loop to make an array of clients and socketindexes and feed it through your "is socket connected" method..and if not.. use listbox.removerow(index#)...getting late so don't know if that makes sense..but will take a look at your code tomorrow and get back to you.. have been working on a bunch of projects for users in the forums :-) my brain is burnt out for the night...

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Tue Jun 05, 2012 9:55 am 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:wink: Please can somebody post a working example willing to donate my wife in exchange lol


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Thu Jun 07, 2012 2:23 am 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
Firstly due to the lack of response to this thread clearly the forum is about as 'useless as a dead rocking horse' with the real studio bods paying virtually no attention to postings.

Secondly the ServersocketServer example could be compared to that of giving a neanderthal an iphone4 with no further instruction.
and expecting him to work it out..!

I notice throughout the forum that several others have asked the same question with regards getting the socket ID of a connected client and furthermore how to communicate with it..! CAN NOT FIND EVEN ONE GOOD EXAMPLE OF HOW THIS CAN BE DONE :roll:

It's either have you checked the examples that come in the Examples folder, or create a subclass array of klingon sub sockets with an index of 0 then call a subroutine and do a sh.execute but make sure that you substitute Null for your #shabang loop OR it's Wash, rinse, repeat....

:lol: No wonder microsoft are taking all the money


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Thu Jun 07, 2012 12:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
LOL. The real problem here is that your question is incredibly broad, and anyone attempting an answer has to either give a gentle nudge in the right direction or roll up their sleeves and prepare to teach a course in programming. There are a million ways to answer it, and the correct/most useful answer depends entirely on how you are approaching the problem and how you have coded the rest of your project.

The simple answer, as you have doubtless read many times already, is to use the serversocket's ActiveConnections method to get an array of the currently connected sockets. What you do with that array depends on a great many factors, all based on your approach/code, so it is impossible to give one definitive answer.

Please provide some more information. And I doubt that most people would download a project and wade through the code as the first step in providing help to a forum question.


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Thu Jun 07, 2012 12:34 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:lol: I am sure that it would take no more than 5 minutes for "James T Kirk" of the Starship RB to add a few lines of code to the ServerSocketServer/ServerSocketClient examples for us federation new recruits to at least get started with... :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: ServerSocket communicating with individual connected cli
PostPosted: Fri Jun 08, 2012 3:09 pm 
Offline

Joined: Sun May 20, 2012 3:47 am
Posts: 22
:? I came to the conclusion that you either have to take out a support agreement with real software, hire a developer or twist and turn your brain cells trying to work it all out. Having been unemployed for the last few months i had no option but to go with the twist and turn option...

Anyhow I have made some progress and will happily post and share my RB source code for all over the next few days to help others that may need a little help understanding how RB sockets work.

One thing that i will say is that personally i think real studio is AWESOME once you get a grips with it. RB is also more powerful than some people believe.. Well done Real software and keep up the good work.

Anyhow here is what i am working on :D

http://www.youtube.com/watch?v=7cBPZihAsgo

:wink:


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