Real Software Forums
http://forums.realsoftware.com/

WEB EDITION ServerSocket App Open Event
http://forums.realsoftware.com/viewtopic.php?f=2&t=46668
Page 2 of 2

Author:  p0wn3d [ Tue Jan 29, 2013 5:41 am ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

:roll: lol still can't figure out what I am not doing correctly.

If anyone has a spare couple of minutes would be grateful if you have a quick look at my WE code and advise.

http://justgoodit.eu5.org/wesocket.zip

Thanks for any help

Author:  Thom McGrath [ Tue Jan 29, 2013 7:02 am ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

From the looks of it, your server socket is an instance on a page. This is wrong, since there could be any number of pages, including 0.

Create a property, not a local variable, on the app class. The type must either be a subclass of ServerSocket, or if you want to use the AddHandler feature, can be of type ServerSocket.

In your App object:
Function ServerAddSocket (Sender As ServerSocket)
Return New ClientSocket
End Function

Event Open
mServer = New ServerSocket
AddHandler mServer.AddSocket, AddressOf Self.ServerAddSocket
mServer.Port = 7777
mServer.MinimumSocketsAvailable = 10
mServer.MaximumSocketsConnected = 100
mServer.Listen
End Event
You should probably watch the error event too.

Author:  p0wn3d [ Tue Jan 29, 2013 8:08 am ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

Tim

Thanks for your help.

I have added the ServerAddSocket function to the App class and created a Property also in the App class 'mserver As ServerSocket'

When debug I get the error: :(

Type mismatch error. Expected Delegate(ServerSocket) as TCPSocket, but got Delegate (ServerSocket) as clientsocket
AddHandler mServer.AddSocket, AddressOf Self.ServerAddSocket

I only have to get this working to show working 'proof on concept' in order to get head of IT/Development to give us the OK
to ditch VB.NET and move forward with the WE for future projects.

:roll: Will be so happy when it's all over (wish I had never been tasked with it at times, but then I am just a humble employee)

Author:  Thom McGrath [ Tue Jan 29, 2013 9:10 am ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

Change your AddSocket return type to TCPSocket.

Author:  p0wn3d [ Wed Jan 30, 2013 3:54 pm ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

:D Thanks Tom with you help things are starting to come together.

Just one more question if I may please.

I have a listbox within my Apps Default webpage and my EasyTCPSocket's connected event is

Session.WebPage1.ListBox1.AddRow(mystring)


My listbox doesn't get populate for some reason. Have looked in the LR but can't seem to find a reference for doing this
with the WE.

Author:  Thom McGrath [ Wed Jan 30, 2013 4:00 pm ]
Post subject:  Re: WEB EDITION ServerSocket App Open Event

Most likely Session is not what you expect it to be. Honestly, I'm surprised you're not getting an exception.

The problem is the socket has no clue which session you mean.

Page 2 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/