Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Sockets - Emulate client

Code
Imports System.Net.Sockets
Imports System.IO

Module Module1



    Dim tcp As TcpClient
    Dim net As NetworkStream

    Sub Main()

        tcp = New TcpClient
        tcp.Connect("", "")

        net = tcp.GetStream
        tcp.GetStream.BeginRead(New Byte() {}, 0, 0, AddressOf Citaj, Nothing)


        Console.ReadLine()

    End Sub

    Public Function Citaj()
        Dim bajt(100) As Byte

        net.Read(bajt, 0, bajt.Length)

        Dim splitme As String() = Split(System.Text.Encoding.Default.GetString(bajt), "/")


        Console.WriteLine(System.Text.Encoding.Default.GetString(bajt))

        Select Case splitme(0)
            Case "login"
                PT("login|username|password")

        End Select



        tcp.GetStream.BeginRead(New Byte() {}, 0, 0, AddressOf Citaj, Nothing)
    End Function



    Public Function PT(ByVal podatak)

        Dim bajt As Byte() = System.Text.Encoding.Default.GetBytes(podatak)

        net.Write(bajt, 0, bajt.Length)
        net.Flush()

    End Function

  





End Module



I have deleted server IP.
I receive data, and when i send data, notihng happens.
Few seconds later, i get 1k empty lines in Console.
Why are you using a function if it doesn't return anything? :facepalm:

The prolem is that you are not listening at the xxxx port
(Jun 7, 2012 05:29 AM)fillobotto Wrote:  Why are you using a function if it doesn't return anything? :facepalm:

The prolem is that you are not listening at the xxxx port

Read first post again.

It returns data/code (random code which I get)
After that i send login data & that code, and after that nothing happens.

No, its not the problem, its client, not server app.
(Jun 7, 2012 05:30 AM)ifans Wrote:  Read first post again.

It returns data/code (random code which I get)
After that i send login data & that code, and after that nothing happens.

No, its not the problem, its client, not server app.

Can you tell us the code of PT method?
(Jun 7, 2012 05:33 AM)fillobotto Wrote:  Can you tell us the code of PT method?

It sends data to server. But it doesnt work.
(Jun 7, 2012 05:37 AM)ifans Wrote:  It sends data to server. But it doesnt work.

You don't say?
Post it here, I'll try to fix it
(Jun 7, 2012 05:49 AM)fillobotto Wrote:  You don't say?
Post it here, I'll try to fix it

Look in first post. Its there...
Thanks
Hey, anyone can help me pelase?
Thank you very much
Are you by any chance putting the port as string ? If I'm not wrong, it should be an integer :/
(Jun 9, 2012 06:55 AM)hoocrax Wrote:  Are you by any chance putting the port as string ? If I'm not wrong, it should be an integer :/

Its okay, since it connects and i receive data, but i cant send it.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by DoomslayerMar 16, 2021 08:19 AM 9 339 Mar 16, 2021 08:19 AM
Last Post: synchronizing
[C] by SIM-4828712Dec 28, 2020 01:17 PM 3 219 Dec 28, 2020 01:17 PM
Last Post: DeadCode
[C#] by indetectableSep 20, 2020 05:12 AM 13 447 Sep 20, 2020 05:12 AM
Last Post: riu41776