Real Software Forums

ServerSocket communicating with individual connected clients
Page 1 of 1

Author:  n00bi3 [ Sun May 20, 2012 5:15 am ]
Post subject:  ServerSocket communicating with individual connected clients

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:

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


Author:  simulanics [ Sun May 20, 2012 11:15 pm ]
Post subject:  Re: ServerSocket communicating with individual connected cli

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...

Author:  n00bi3 [ Tue Jun 05, 2012 9:55 am ]
Post subject:  Re: ServerSocket communicating with individual connected cli

:wink: Please can somebody post a working example willing to donate my wife in exchange lol

Author:  n00bi3 [ Thu Jun 07, 2012 2:23 am ]
Post subject:  Re: ServerSocket communicating with individual connected cli

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

Author:  timhare [ Thu Jun 07, 2012 12:22 pm ]
Post subject:  Re: ServerSocket communicating with individual connected cli

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.

Author:  n00bi3 [ Thu Jun 07, 2012 12:34 pm ]
Post subject:  Re: ServerSocket communicating with individual connected cli

: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:

Author:  n00bi3 [ Fri Jun 08, 2012 3:09 pm ]
Post subject:  Re: ServerSocket communicating with individual connected cli

:? 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


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group