Hopefully this class can be usefull for u guys...![]()
Hopefully this class can be usefull for u guys...![]()
since it is posted under CodeBank - VISUAL BASIC .NET, so its clear that the class is written in VB.NET, however it still can be compiled as .NET component and be used in C++ or C# project.
To clarify what the functionalities of the class are and how it can be implemented into ur application:
----------------------------------------------------------------------------------
This class is made to have similar functionality with Winsock control in VB6. It provide the basic functions like Listen, Connect, Close, and also events like Connecting, Connected, DataArrival, IncomingConnection. However, it is not as complex as VB6 Winsock. Whoever has ever used VB6 Winsock control should have no problem using this class.
This class may be freely distributed and be used in any application. The user may also modify the original code and extend the functionalities.
To use the class just simply declare with WithEvents keyword. Declare one as client and another as server, they should reside in different applications or in the same one if required. Remember to declare an instance before using any of its members:
Dim WithEvents cServer as clsTCPSocket
Dim WithEvents cClient as clsTCPSocket
'the server must listen to an avalaible port before the client can connect
Private Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
cServer.Listen(100)
End Sub
'to connect just simple call the connect function with the same port number as specified by server.
Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
cClient.Connect("PCName", 100)
End Sub
Private Sub IncomingConnHandler() Handles cServer.IncomingConnection
cServer.Accept()
End Sub
to send data just call SendData function, the DataArrival event will be invoked when the data received.
Any Chance of a sample app using this class as I cant get this to work.
You Beauty!!!
This fixed most of my problems!! Works far better then SocketsClient.
can you give a sample solution on how to use your class, am relly new in .net technologies
Programming is all about good logic. Spend more time here
(vHost for Apache) (Generate pronounceable password) (Generate random number c#) (Filter array with another array)
Can Somebody help me with this class? I need an example how to receive data...Any change to get help on this old post?
i got some problem with dataArraival of this class. can you plz tell me how can get incomming bytes properly as string
can u please add index for every connection like this
to control between multiple connections ??Code:Public Sub client_Connected(ByVal Index As Integer) Handles client.Connected End Sub
thanks for this amazing class![]()
Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | Create Sortable BindingList(not mine) | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading
C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter
There's just no reason to use garbage like InputBox. -jmcilhinney