Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Thanks Trent, "End" did the trick. I knew it should be something really simple
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
In VB you can just call "End": End But the Exit should have worked. I use this at times to provide an exit code so I can tie into other applications (or shells ) and take logic if a certain exit code occurs.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Trent, I am trying to implement my version of Service Console to send the connection information to a SF application. In the AppMain.vb I need to communicate with the Service and get the connection, so far so good, I am doing this in the SetDataSources(), but if something is wrong and I need to close the application how do I do that? I tried something like:
System.Windows.Forms.Application.Exit()
Exit sub
But the flow of the StrataFrameApplication.RunApplication() continues instead of exiting. Any recommendation on how to stop the application if I don't get the connection string from my Service?
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
One more question, for the client do you allow the end user to type in the IP address of the Server to connect to or is there a way for the client to discover the Server? We do allow it if the server cannot be automatically located. We use a UDP boradcast from the client if it cannot connect t the server. The server is listening on that UDP port and sends out a UDP broadcast of its location to which the client will retrieve the servers location and login. You can find a lot of samples on the internet about this. I did a quick serach and found some CodeProject samples. Here is a chart sample that uses a UDP broadcast. http://www.codeproject.com/KB/IP/socketsincs.aspx?fid=2956&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=1070795
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Trent, One more question, for the client do you allow the end user to type in the IP address of the Server to connect to or is there a way for the client to discover the Server? In my case, I would like to keep the client locked down to the network segment they are installed on, this way a customer with different branches will not be able to connect to the Server Service from remote locations. Any suggestion on how to handle this logistic situation?
Edhy Rijo
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Awesome Edhy! I'm jonesing to work on a service like this myself...alas, no time at the moment. I'll be referring back to this thread when I do though!
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Trent/Greg, Just a note to say thanks again. So far I was able to create my version of a Server Console and a Server Service using the IP*Works library from www.nsoftware.com and the book for Windows Services suggested by Greg in this thread. This has been a great experience working outside of just the database process, using secured XML files managed by the SF Business Object to store the Server Settings information and using a ListView with all the goodies of the SF BO to show connected clients without saving any data to a database, this whole process shows once again the power in the SF framework. On a side note, I was having a lot of trouble with the IP*Works and sending the BO as a byte array, despite Trent's support replies I could not make it work to a satisfactory level, so I decided to simply use a predefined string which I then parsed and it worked just great. Thanks guys!
Edhy Rijo
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Trent L. Taylor (03/11/2009) Using the ServiceController class. It makes it really easy!Cool! I'll check that out.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
I am not sure what e.TextB is, but assuming it is the serizlized byte array, you are not placing the deserialized BO into a variable: loBo = BusinessLayer.DeserializeBusinessObject(e.TextB) And you will need to type is as well. So it would look more like this: Dim loBO As bizConnectedClients loBO = DirectCast(BusinessLayer.DeserializeBusinessObject(e.TextB), bizConnectedClients)
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Trent, Thanks for the info. Now back to serialization, I am trying to use the SerializeToByteArray but it is not working for me, I have the feeling my code is not correct, here is my approach: ' Serialize the BO into a ByteArray Dim pszOutByte As System.Byte()pszOutByte = Me.bizConnectedClients1.SerializeToByteArray
' DeSerialize the BO from a ByteArray Dim loBO As New bizConnectedClientsBusinessLayer.DeserializeBusinessObject(e.TextB) Me.BizConnectedClients1.CopyDataFrom(loBO, BusinessCloneDataType.ClearAndFillFromDefaultView)loBO.Dispose()
In above code e.TextB contain the serialized BO byte stream. When testing this I get the following error when trying to Deserialize the BO: SerializationException The input stream is not a valid binary format. The starting contents (in bytes) are: 34-31-36-32-32-34-36-33-0D-0A-54-65-73-74-20-4F-6E ... Source : System.Windows.Forms Stack Trace: at System.Windows.Forms.Control.EndInvoke(IAsyncResult asyncResult) at nsoftware.IPWorks.Ipport.nsoftware.core.IIpportEvents.FireDataIn(Byte[] text, Boolean EOL)
What is it that I am missing here?
Edhy Rijo
|
|
|