Click here to Skip to main content
12,240,822 members (60,485 online)
Click here to Skip to main content
Add your own
alternative version

Stats

315K views
12.4K downloads
94 bookmarked
Posted

TCP/IP With VB.Net - version 2(more power-more ease)

, 1 Jun 2005 CPOL
Rate this:
Please Sign up or sign in to vote.
Exposes one of the most easy to use .net assembly for giving TCP/IP functionalities to any .Net environment

Sample screenshot

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 Smile | :) .

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
        'sender IP
        Dim sip As String = Args.senderIP
        Dim DATA As String = Args.message
        'And you stuff here
        'If DATA.equals(........
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
        'Me.FoundIPList.Items.Add(IP)
        'Me.FoundIPList.Refresh()
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

uno freeware
Web Developer
Italy Italy
...picture was not for codeproject hihihi.
well my usual way is to release only classes wich can be used by you very easily and quickly.

You may also be interested in...

Comments and Discussions

 
QuestionServer is binding to wrong IP on my PC, Pin
Craig H23627-Jan-14 11:45
memberCraig H23627-Jan-14 11:45 
QuestionWhere is the source code download? Pin
Tim_102417-Jan-13 3:49
memberTim_102417-Jan-13 3:49 
QuestionRe: Where is the source code download? Pin
Member 96701931-Apr-13 12:44
memberMember 96701931-Apr-13 12:44 
AnswerRe: Where is the source code download? Pin
Tim_102411-Apr-13 3:06
memberTim_102411-Apr-13 3:06 
GeneralRe: Where is the source code download? Pin
jak6455-Jul-14 8:34
memberjak6455-Jul-14 8:34 
GeneralRe: Where is the source code download? Pin
mmminchia28-Aug-14 12:43
membermmminchia28-Aug-14 12:43 
QuestionHow to send a string array? Pin
Aldrin Jay Morales22-Sep-12 19:53
memberAldrin Jay Morales22-Sep-12 19:53 
GeneralMax connections Pin
Michael Timmermans19-Jul-12 0:56
memberMichael Timmermans19-Jul-12 0:56 
QuestionThank you Pin
forkee11-Jul-12 7:02
memberforkee11-Jul-12 7:02 
QuestionAttempted Download Pin
Member 90429867-Jul-12 16:22
memberMember 90429867-Jul-12 16:22 
GeneralMy vote of 5 Pin
manoj kumar choubey24-Feb-12 3:47
membermanoj kumar choubey24-Feb-12 3:47 
BugCrash on "unknown connection" Pin
xerax13-Dec-11 2:07
memberxerax13-Dec-11 2:07 
GeneralRe: Crash on "unknown connection" Pin
uno freeware5-Apr-12 12:49
memberuno freeware5-Apr-12 12:49 
GeneralRe: Crash on "unknown connection" Pin
ayman metwally30-Dec-13 21:40
memberayman metwally30-Dec-13 21:40 
BugVirus reported! Pin
LeoKiz2-Nov-11 11:27
memberLeoKiz2-Nov-11 11:27 
BugDownload Pin
michaelbarb4-Oct-11 11:39
membermichaelbarb4-Oct-11 11:39 
GeneralRe: Download Pin
uno freeware5-Oct-11 5:22
memberuno freeware5-Oct-11 5:22 
GeneralRe: Download Pin
michaelbarb5-Oct-11 6:19
membermichaelbarb5-Oct-11 6:19 
QuestionReceiving Data from the Client? Pin
antonio62228-Jan-11 20:31
memberantonio62228-Jan-11 20:31 
AnswerRe: Receiving Data from the Client? Pin
Crook_EVB4-Apr-11 23:56
memberCrook_EVB4-Apr-11 23:56 
GeneralMy vote of 5 Pin
iamgowda16-Dec-10 23:59
memberiamgowda16-Dec-10 23:59 
GeneralLooking for info, or a better solution [modified] Pin
Crook_EVB20-Nov-10 0:26
memberCrook_EVB20-Nov-10 0:26 
RantPackage Virus Pin
Twaitsey1-Nov-10 11:10
memberTwaitsey1-Nov-10 11:10 
GeneralRe: Package Virus Pin
uno freeware4-Nov-10 11:58
memberuno freeware4-Nov-10 11:58 
GeneralAgain Pin
uno freeware20-Aug-10 5:29
memberuno freeware20-Aug-10 5:29 
GeneralRe: Again Pin
Crook_EVB4-Apr-11 4:56
memberCrook_EVB4-Apr-11 4:56 
GeneralRe: Again Pin
uno freeware4-Apr-11 7:48
memberuno freeware4-Apr-11 7:48 
GeneralRe: Again Pin
Crook_EVB4-Apr-11 10:35
memberCrook_EVB4-Apr-11 10:35 
QuestionSendfiles Progressbar ? Pin
abensrhir6-Aug-10 4:36
memberabensrhir6-Aug-10 4:36 
AnswerRe: Sendfiles Progressbar ? Pin
uno freeware20-Aug-10 5:30
memberuno freeware20-Aug-10 5:30 
Questionerror in sending files Pin
monicasegundo1-Mar-10 12:52
membermonicasegundo1-Mar-10 12:52 
GeneralMy vote of 1 Pin
comasic24-Sep-09 10:51
membercomasic24-Sep-09 10:51 
GeneralRe: My vote of 1 Pin
uno freeware23-Dec-09 3:39
memberuno freeware23-Dec-09 3:39 
GeneralRe: My vote of 1 Pin
uno freeware23-Dec-09 3:44
memberuno freeware23-Dec-09 3:44 
QuestionCross-thread error ? Pin
dpcons11-Aug-09 11:22
memberdpcons11-Aug-09 11:22 
GeneralChange the IP of the listner to anothert device Pin
Tim Norton15-Jul-09 16:29
memberTim Norton15-Jul-09 16:29 
GeneralOverload resolution failed because no accessible 'Send' can be called without a narrowing conversion Pin
Mohammad Al Hoss16-Apr-09 6:01
memberMohammad Al Hoss16-Apr-09 6:01 
GeneralRe: Overload resolution failed because no accessible 'Send' can be called without a narrowing conversion Pin
uno freeware16-Apr-09 8:44
memberuno freeware16-Apr-09 8:44 
QuestionTCP and timer problem Pin
tommasopit18-Mar-09 1:22
membertommasopit18-Mar-09 1:22 
AnswerRe: TCP and timer problem Pin
uno freeware18-Mar-09 1:58
memberuno freeware18-Mar-09 1:58 
GeneralRe: TCP and timer problem Pin
tommasopit18-Mar-09 2:31
membertommasopit18-Mar-09 2:31 
GeneralInternet working Pin
rgccvieira2-Dec-08 17:14
memberrgccvieira2-Dec-08 17:14 
GeneralProblems with receiving a message Pin
matzensens7-Oct-08 5:04
membermatzensens7-Oct-08 5:04 
QuestionSend file over Gprs Pin
Badoxo21-Sep-08 16:45
memberBadoxo21-Sep-08 16:45 
Questionbetter than just on a lan? Pin
ejf286-May-08 16:48
memberejf286-May-08 16:48 
Questionproblems when sending file Pin
Guoi10-Jan-08 18:47
memberGuoi10-Jan-08 18:47 
GeneralError when connected wih IE. Pin
kung_kaset451-Jan-08 10:51
memberkung_kaset451-Jan-08 10:51 
GeneralRe: Error when connected wih IE. Pin
uno freeware3-Jan-08 12:26
memberuno freeware3-Jan-08 12:26 
QuestionWhere have the Source files gone? Pin
PerryM7-Dec-07 14:39
memberPerryM7-Dec-07 14:39 
QuestionMultiple File Sending Pin
nikkivalerio14-Nov-07 19:16
membernikkivalerio14-Nov-07 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160426.1 | Last Updated 1 Jun 2005
Article Copyright 2005 by uno freeware
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid