
Introduction
Here it is. (Thanks to <- uno sh4re -> for coding sh*t)
Finally UnoLibs.Net V2 is done, and special Example app is made for CodeProject.
Remember this sh*t is released under GNU LGPL, this means you can use it for
whatever, including commercial.
1.UnoLibs.Net.dll / What is it?
UnoLibs.Net.dll is one of most easy to use library for giving TCP/IP functionalities to your .net app.
NO DEAL WITH THREADS AND SOCKETS(it's full managed)
No need of system.windows namespace( means you can use it for interfaceless application such as a .net console application )
What you get is a small set(3) or highly cusomizable classes wich can be used with ease, including a multithreaded server.
C# Programmers can use this library as well as VB.net users, usage steps are the same and the code needed is very easy to intend for using in c#.
(C# documentation would come in some time if some ask)
It exposes 3 Classes just made for being easy:ServerClass, ClientClass, ServerScanner.
The Article Shows one usage of theese classes, as they are implemented in the Example Application code.
2.What will i find in the Downloads?
-ExampleApp.Zip :This one contains the compiled versione of the example
You can download this, execute and and try it on your
localIP (loopback connection), or also you can install
it in more computer and test it over a network.
-ULNSource.zip : This one contains a compiled version of the library and a
VS.NET solution specially made for CodeProject.
The solution is made of 2 projects:
-UnoLibs.Net
-Example App
Of course Example App references to UnoLibs.Net
Both Also contains EvID4226Patch.exe wich let u modify the max number of simultaneous halfopened connection wich is limited to 15 in many new Os (2000/XP/2003), this is required in order to get the scanner working with more than 15 threads :).
3.How do i use this?
To use UnoLibs.Net, just follow 3 easy steps
1 Download any of the avaiable downloads and get UnoLibs.dll out of the zip file
2 In Visual Studio, Add the reference to UnoLibs.dll
Your project can now use the classes exposed by the assembly.
3 Have fun using the classes with ease.
The usage is very easy and the references should be chomprensive of any important
information, however i'll write here topic usage for all of the 3 classes exposed.
4.Usage
Please note that this page shows (in the code snippets) ALL of the code
needed for getting the class to work and use them, no more code is needed.
ClientClass Usage
Create the ClientClass Instance
Dim Client As New UNOLibs.Net.ClientClass
Sending messages(bytes/data) to any server on specified IP/PORT is very easy.
Client.SendMessage(IP, PORT, DATA)
Sending files to specified IP/PORT is very easy.
Client.SendFiles(IP, PORT, dialog.FileNames)
That's it for the client!!!
ServerClass Usage
Create the ServerClass Instance (Withevents is specified for using "handles" clause later)
Dim WithEvents Server As UNOLibs.Net.ServerClass
Initialize the server on specified PORT(auto retrieves local IP) is very easy, using true will autostart the server and "C:\" is the Path for saving incoming files.
Server = New UNOLibs.Net.ServerClass(PORT, True, "C:\")
Now you need to catch Incoming Messages from IPs, easily do this with a sub
that handles the incoming message event of the ServerClass.
Private Sub OnIncomingMessage(ByVal Args As UNOLibs.Net.ServerClass.InMessEvArgs)Handles Server.IncomingMessage
Dim sip As String = Args.senderIP
Dim DATA As String = Args.message
End Sub
Note here that you can implement a similar handles sub also for capturing Diagnostics Messages for example to know when a file transfer session begins or ends(see the exampleapp code for more infos)
Changing the path for incoming file is easy.
Server.IncomingPath = "C:\Incoming Files"
That's it for the server.
ServerScanner Usage
Create the instance of ServerScanner
Dim WithEvents Scanner As UNOLibs.Net.ServerScanner
What to do when IPs are found on the specified PORT?
most probably something like that.
Private Sub OnIPFound(ByVal IP As String) Handles Scanner.IPfound
End Sub
Hmmmm let's start the scan
Scanner.StartScan()
That's It for the ServerScanner
NOTE on ServerScanner : If you are interested in catching perform bar step and scan finished events please refer to the very easy Example APP code.
5.Interesting Part
-With a couple of lines of code you get a multithreaded server that will start
a new process every 100 ms for processing eventually pending connections.
-Since old V1, UnoLibs.Net makes a smart usage of the events so that you can
execute your code with ease "on event"
-NEW IN V.2
-Fixed some bugs for the scanner class and improved scanning, can now be selected
number of threads and timout (for xp sp2 users tcp fix patch required)
-Added a fast and easy SEND FILES function for client
-Added surely other minor bugs :P....
6.More about UnoLibs
UnoLibs are a collection of free (LGPL/Similar) tools and .net libraries.
Some are made by unoTeam, some are directly referenced thanks to the authors
and some are only linked.
The entire project (just begun!)is hosted at Http://www.freewebs.com/unoteam
Main idea is to always have a complete-non repetitive SET of multipurpose and
reusable libraries for any kind of use, always at hand.
Key feature for any tool/library of the UnoLibs is the ease of use and reuse-ability.