Thursday, April 23, 2009

spydrphi.messaging

This is a simple class that I wrote (VB.NET 1.1) to allow for simple TCP Client/Server message and file transfers.
spydrphi.messaging.dll
SimpleTCPClient Class
Public Functions:
SendMessage(IPAddress As String, Port As Integer, Message As String) As Boolean
SendMessage(IPAddress As String, Port As Integer, FileName As String, OpenFileStream As FileStream) As Boolean
[The FileName string in the second option is limited to 52 characters including extension]
[The OpenFileStream requires that the client open the file and pass the file stream handle to the function, do not pass an empty file stream (I might change this later, but the way it works for now)]
SimpleTCPServer Class
Public Properties:
Port As Integer (default 10019)
FileLocation As String (default c:\) - If the server is receiving files
Output As String - Holds data received, should be read by your server client w/ Waiting
Waiting As Boolean - Value is set to true when Output contains data to be read, reset to False when Server Client read is complete
Public Sub Method:
StartServer()

These classes both utilize the spydrphi.errors (msgbox_error) class, which is also included in the package.

The spydrphi.messaging class can be located on the wiki here (http://wiki.spydrphi.com/Home/utilities/spydrphi-messaging/spydrphi.messaging.zip?attredirects=0).

No comments: