Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive

    [Open Source]Docket[TCP Socket DLL] (Client Only)

    okay i wrote this up pretty quick cause i saw that other post about making a open source one so i wrote this in like 10 min :P

    its only the client if you guys like ill write the Server Aswell

    i will not include downloads ill just post pure source

    It includes events, anti crashing, reconnect if connection fails and properties
    The Source is Not Commented on but it is only VB.NET

    if you want to see more shit like this say so i can code this shit in VB.NET and C# just send me a pm or reply

    Code:
    'Credits To DeToX <--Thats Me
    'Fast Simple Socket System Open Source
    'Please Include Credits
    'DocketClass
    Imports System.Threading, System.Net, System.IO, System.Net.Sockets
    Public Class Client
    #Region "Declarations"
        Dim TcpClient As New TcpClient()
        Dim Remote_IP As String = vbNull
        Dim Remote_Port As Int32 = vbNull
        Public Event RecievedData(ByVal Data As String)
        Public Event FailToConnect(ByVal Reason As String)
    #End Region
    #Region "Main Code"
        Sub New(ByVal IP As String, ByVal Port As Int32)
            Remote_IP = IP
            Remote_Port = Port
        End Sub
        Sub Connect()
            Try
                TcpClien*****nnect(Remote_IP, Remote_Port)
                TcpClient.GetStream().BeginRead(New Byte() {0}, 0, 0, AddressOf Recieve, Nothing)
            Catch ex As Exception
                Thread.Sleep(4000)
                RaiseEvent FailToConnect("Error Connecting To Host")
                Connect()
            End Try
        End Sub
        Sub Recieve(ByVal Ar As IAsyncResult)
            Try
                Dim Reader As New StreamReader(TcpClient.GetStream())
                RaiseEvent RecievedData(Reader.ReadLine())
                TcpClient.GetStream().BeginRead(New Byte() {0}, 0, 0, AddressOf Recieve, Nothing)
            Catch ex As Exception
                Thread.Sleep(4000)
                RaiseEvent FailToConnect("Error Reading Data From Host")
                Connect()
            End Try
        End Sub
        Sub SendData(ByVal Data As String)
            Try
                Dim Writer As New StreamWriter(TcpClient.GetStream())
                Writer.WriteLine(Data)
                Writer.Flush()
            Catch ex As Exception
                Thread.Sleep(4000)
                RaiseEvent FailToConnect("Error Sending Data To Host")
                Connect()
            End Try
        End Sub
    #End Region
    #Region "Properties"
        Private ReadOnly Property BufferSize
            Get
                Return TcpClient.ReceiveBufferSize()
            End Get
        End Property
        Private ReadOnly Property Connected
            Get
                Return TcpClien*****nnected
            End Get
        End Property
        Private ReadOnly Property Available
            Get
                Return TcpClient.Available
            End Get
        End Property
    #End Region
    End Class

  2. #2
    cosconub's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    in the programming section MPGH Cash: $90,000,000,000
    Posts
    372
    Reputation
    -4
    Thanks
    39
    My Mood
    Psychedelic
    thanks Detox ,

    Guy's this is my long time buddy, he is trust worthy!

    A man is but the product of his thoughts what he thinks, he becomes.
    ~Mohandas Gandhi


    A Genius is nothing with out an idea, An idea is always an idea even without a genius.
    ~ Immortal

  3. #3
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    beat me lol, but mine will be better ^.^

  4. #4
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive
    Wait Till I Post My C# one :P im gunna show other things to like how to send pictures and files more then the maxium amount of data TCP can send

  5. #5
    cosconub's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    in the programming section MPGH Cash: $90,000,000,000
    Posts
    372
    Reputation
    -4
    Thanks
    39
    My Mood
    Psychedelic
    uhg detox dont release are whole c# rat we plan on selling the source rember,

    A man is but the product of his thoughts what he thinks, he becomes.
    ~Mohandas Gandhi


    A Genius is nothing with out an idea, An idea is always an idea even without a genius.
    ~ Immortal

  6. #6
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    Quote Originally Posted by Deto View Post
    Wait Till I Post My C# one :P im gunna show other things to like how to send pictures and files more then the maxium amount of data TCP can send
    so it will be udp/tcp?

  7. #7
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive
    maybe but UDP sucks because data sometimes isnt recieved in the same order it is sent...

  8. #8
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    Quote Originally Posted by Deto View Post
    maybe but UDP sucks because data sometimes isnt recieved in the same order it is sent...
    dosen't mean its bad, its just different.

  9. #9
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive
    meh i never said it was bad.... UDP Does transfer more then TCP so is usefull for files and shit

  10. #10
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    TCP for standard data transfer, UDP primarily for Video & Audio.
    UDP is Faster then TCP but it not meant for standard data information at all, UDP does not provide any flow and congestion control, It's meant to send data as fast as possible without any error handling.

    So as to which is better or worse, it's more of a matter of use & Reason.

    @ OP's source, Looks Good.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  11. #11
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by Deto View Post
    meh i never said it was bad.... UDP Does transfer more then TCP so is usefull for files and shit
    UDP is definitely worse for transferring files... Unless you implement checksum verification - UDP does not provide guaranteed packet delivery, whereas TCP does, to an extent

  12. The Following User Says Thank You to freedompeace For This Useful Post:

    NextGen1 (02-03-2011)

  13. #12
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive
    ugh :Pthe TCP Server im making to go along with this has a property to display all incomming bytes and packets

  14. #13
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by Deto View Post
    ugh :Pthe TCP Server im making to go along with this has a property to display all incomming bytes and packets
    you should add a UDP Client too xD. I'm updating my class, it's now utmost done.
    I added:
    1. Log System
    2. Statistics
    3. UDP Client
    4. Voice Transfert ( Non-Tested )
    5. Server Manager

  15. #14
    Deto's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    43
    Reputation
    10
    Thanks
    2
    My Mood
    Aggressive
    Quote Originally Posted by freedompeace View Post
    UDP is definitely worse for transferring files... Unless you implement checksum verification - UDP does not provide guaranteed packet delivery, whereas TCP does, to an extent


    you could also use split


    Packet Example
    Code:
    FILEPIECE(1):Bytes Of File
    then increase the (1) with each file peice

    hmm im gunna just ditch this project actually and write a new one in c# its a lot easier :P C# .net :P
    Last edited by Deto; 02-03-2011 at 02:37 PM.

  16. #15
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by Deto View Post
    you could also use split


    Packet Example
    Code:
    FILEPIECE(1):Bytes Of File
    then increase the (1) with each file peice

    hmm im gunna just ditch this project actually and write a new one in c# its a lot easier :P C# .net :P
    Even if you do that, because of the UDP design, you have no guarantee that you will receive all packets, and no knowledge if you do happen to miss one. You might even get a packet twice, or out of order!

    UDP has its uses, however. Things like (simple) chat clients, multimedia streaming and online games are great for UDP. UDP is "connectionless", has no initial overhead before transfer (which is quite significant in TCP), and doesn't try to address a problem with flow control when you miss a packet, because by the time the error correction has finished it's probably too late to use it anyway, and so on.

Page 1 of 2 12 LastLast