Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [RELEASE]Socket Server Class

[RELEASE]Socket Server Class

Posts 1–11 of 11 · Page 1 of 1
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
[RELEASE]Socket Server Class
Heya guys,
I just finished a class library of sockets, and I'm releasing it here. This actually has all the more useful functions of a server side, and client side. You can send messages, check if you got any messages, etc...

There is a lil' example:
Code:
Imports Sockets_Server.SocketsServer
Module SSTest

    Public Client As New ClientSide("localhost", 4475)
    Public Server As New ServerSide(4475)

    Sub Main()

    End Sub

End Module
The current functions, properties of the client side are:
SendString(String)
SendInteger(Integer, Integer)
SendBytes(Byte())
GotString(String)
GotInteger(Integer, Integer)
GotBytes(Byte())
Property: HostName
Property: Port


The current functions, properties of the server side are:
SendString(String)
SendInteger(Integer, Integer)
SendBytes(Byte())
GotString(String)
GotInteger(Integer, Integer)
GotBytes(Byte())
Property: Port


**Note: All the functions got comments, so I think it's easy to know what are you going to do.**

Virus scan: VirusTotal - Free Online Virus, Malware and URL Scanner

Full source:
Code:
Imports System.Net
Imports System.Net.Sockets
Imports System.IO

Namespace SocketsServer

    Public Class ClientSide

        Private PortNum As Integer
        Private Host As String

        ''' <summary>
        ''' Gets the current port number of the server which is begin used by this client
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Port As Integer
            Get
                Return PortNum
            End Get
        End Property

        ''' <summary>
        ''' Gets the current ip of the server which is begin used by this client
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property HostName As String
            Get
                Return Host
            End Get
        End Property

        Public Sub New(ByVal hostname As String, ByVal port As Integer)
            PortNum = port
            hostname = Host
        End Sub

        Private TCPC As New TcpClient(Host, PortNum)

        ''' <summary>
        ''' Sends a string value via a socket to the remote host. ACE ROCKS!!!
        ''' </summary>
        ''' <param name="str"></param>
        ''' <remarks></remarks>
        Public Sub SendString(ByVal str As String)
            Dim s As Stream = TCPC.GetStream
            If Not TCPC.Connected Then
                Try
                    TCPC.Connect(Host, PortNum)
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Else
                s.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(str), 0, str.Length)
            End If
        End Sub

        ''' <summary>
        ''' Sends a integer value via a socket to the remote host. ACE ROCKS!!!
        ''' </summary>
        ''' <param name="int"></param>
        ''' <remarks></remarks>
        Public Sub SendInteger(ByVal int As Integer, ByVal count As Integer)
            Dim s As Stream = TCPC.GetStream
            If Not TCPC.Connected Then
                Try
                    TCPC.Connect(Host, PortNum)
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Else
                s.Write(BitConverter.GetBytes(int), 0, count)
            End If
        End Sub

        ''' <summary>
        ''' Sends a array of bytes via a socket to the remote host. ACE ROCKS!!!
        ''' </summary>
        ''' <param name="b"></param>
        ''' <remarks></remarks>
        Public Sub SendBytes(ByVal b() As Byte)
            Dim s As Stream = TCPC.GetStream
            If Not TCPC.Connected Then
                Try
                    TCPC.Connect(Host, PortNum)
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Else
                s.Write(b, 0, b.Length)
            End If
        End Sub

        ''' <summary>
        ''' Gets if the client got the message (string) from the server or not. ACE ROCKS?
        ''' </summary>
        ''' <param name="str"></param>
        ''' <remarks></remarks>
        Public Function GotString(ByVal str As String) As Boolean
            Dim s As Stream = TCPC.GetStream
            If s.Read(System.Text.ASCIIEncoding.ASCII.GetBytes(str), 0, str.Length) Then
                Return True
            Else
                Return False
            End If
        End Function

        ''' <summary>
        ''' Gets if the client got a message (integer) from the server. ACE ROCKS?
        ''' </summary>
        ''' <param name="int"></param>
        ''' <param name="len"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GotInteger(ByVal int As Integer, ByVal len As Integer) As Boolean
            Dim s As Stream = TCPC.GetStream
            If s.Read(BitConverter.GetBytes(int), 0, len) Then
                Return True
            Else
                Return False
            End If
        End Function

        ''' <summary>
        ''' Gets if the client got a array of bytes from the server. ACE ROCKS?
        ''' </summary>
        ''' <param name="b"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GotBytes(ByVal b() As Byte) As Boolean
            Dim s As Stream = TCPC.GetStream
            If s.Read(b, 0, b.Length) Then
                Return True
            Else
                Return False
            End If
        End Function
    End Class

    Public Class ServerSide

        Private pn As Integer
        Private TCPS As New TcpListener(pn)

        ''' <summary>
        ''' Gets the current port number of the server
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Port As Integer
            Get
                Return pn
            End Get
        End Property

        Public Sub New(ByVal port As Integer)
            pn = port
            TCPS.Start()
        End Sub

        ''' <summary>
        ''' Sends a string message to all the clients
        ''' </summary>
        ''' <param name="str"></param>
        ''' <remarks></remarks>
        Public Sub SendString(ByVal str As String)
            Dim s As Socket = TCPS.AcceptSocket
            Try
                s.Send(System.Text.ASCIIEncoding.ASCII.GetBytes(str))
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub

        ''' <summary>
        ''' Sends a integer value to all the clients
        ''' </summary>
        ''' <param name="int"></param>
        ''' <remarks></remarks>
        Public Sub SendInteger(ByVal int As Integer)
            Dim s As Socket = TCPS.AcceptSocket
            Try
                s.Send(BitConverter.GetBytes(int))
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub

        ''' <summary>
        ''' Sends a array of bytes to all the clients
        ''' </summary>
        ''' <param name="b"></param>
        ''' <remarks></remarks>
        Public Sub SendBytes(ByVal b() As Byte)
            Dim s As Socket = TCPS.AcceptSocket
            Try
                s.Send(b)
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub

        ''' <summary>
        ''' Gets if the server got or not a string message from the client(s)
        ''' </summary>
        ''' <param name="msg"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GotString(ByVal msg As String) As Boolean
            Dim s As Socket = TCPS.AcceptSocket
            If (s.Receive(System.Text.ASCIIEncoding.ASCII.GetBytes(msg))) Then
                Return True
            Else
                Return False
            End If
        End Function

        ''' <summary>
        ''' Gets if the server got or not a integer value from the client(s)
        ''' </summary>
        ''' <param name="int"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GotInt(ByVal int As Integer) As Boolean
            Dim s As Socket = TCPS.AcceptSocket
            If (s.Receive(BitConverter.GetBytes(int))) Then
                Return True
            Else
                Return False
            End If
        End Function

        ''' <summary>
        ''' Gets if the server got or not a array of bytes from the client(s)
        ''' </summary>
        ''' <param name="b"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GotBytes(ByVal b() As Byte) As Boolean
            Dim s As Socket = TCPS.AcceptSocket
            If (s.Receive(b)) Then
                Return True
            Else
                Return False
            End If
        End Function

    End Class

End Namespace
Thanks, and enjoy =)

P.S.
Report here any kind of bugs that you found, also I will add a log function later, cause now it's kinda late....
#1 · edited 15y ago · 15y ago
cosconub
cosconub
thank you, Would you beable to release the source so i can convert it to c#?

but thanks!
#2 · 15y ago
lolbie
lolbie
well you send me the link for this topic on msn but what does it do?
#3 · 15y ago
NextGen1
NextGen1
Clean And Approved.
It's a class, so easy to use.

Really this should be in Open source, I want to build a repository. So collecting anything Open Source would be great.
#4 · 15y ago
freedompeace
freedompeace
Quote Originally Posted by cosconub View Post
thank you, Would you beable to release the source so i can convert it to c#?

but thanks!
Visual Basic and C# both compile to MSIL, and can be used together.
#5 · 15y ago
cosconub
cosconub
oh didnt know they Can be used together, this jus made my life 1 millon time easyier
#6 · 15y ago
Lolland
Lolland
Good release, helpful!
#7 · 15y ago
DE
Deto
http://www.mpgh.net/forum/33-visual-...ient-only.html <--- open source Client Only TCP Socket :P Just Thought it might help also if you kno more about sockets :P

Also this is to help the OP Owner... AcE.bu50t Check that thread to learn how to use events instead of functions to recieve Data and shit
#8 · edited 15y ago · 15y ago
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
thx guys, btw: added source

Quote Originally Posted by Deto View Post
http://www.mpgh.net/forum/33-visual-...ient-only.html <--- open source Client Only TCP Socket :P Just Thought it might help also if you kno more about sockets :P

Also this is to help the OP Owner... AcE.bu50t Check that thread to learn how to use events instead of functions to recieve Data and shit
nice but, I luv using functions
#9 · 15y ago
DE
Deto
events are better though for events because then as soon as the client recieves data from the server you event will raise with the data from the server instead of coding a loop to keep checkin the server for data :P
#10 · 15y ago
♪~ ᕕ(ᐛ)ᕗ
♪~ ᕕ(ᐛ)ᕗ
Quote Originally Posted by Deto View Post
events are better though for events because then as soon as the client recieves data from the server you event will raise with the data from the server instead of coding a loop to keep checkin the server for data :P
I still luv the functions.
#11 · 15y ago
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Tags for this Thread

None