Jump to content

TCPListen


Recommended Posts

... definatly local,

Thats right.

but if its local then how do you connect to a remote port :-/

In two words ? you don't.

What do you think that call is named "TCPListen" ? :lmao:

What you do is to create a port to which the remote party can connect.

Exactly as you do when you browse the Web : you connect to a server that is listening at port 80 (the default port for HTTP-traffic).

In other words : TCPListen is a passive command : you let others come to you.

And when they do you use TCPAccept to accept (duh! :ph34r: ) the connection so you can talk (TCPRecv TCPSend) with whomever contacted you.

Hope that helps.

Link to comment
Share on other sites

i understand this but it never works thats the thing, tcpconnect connects to a remote port but the thing is using TCPRecv / TCPSend with it does not work and i dont know why , the TCP stuff has just really confused me not to big on it so after acouple days of trying it gets irritating,

Link to comment
Share on other sites

the TCP stuff has just really confused me not to big on it so after acouple days of trying it gets irritating,

So you have a specific problem with some specific code, but you you're not making that code available to us .... :lmao:

That pretty-much prohibits us from giving any kind of real help : all you will, or rather can get is guesses. And those are mostly not all that effective in solving a problem. :geek:

So, my suggestion is thatv you show is your code, and explain to us what it should do (both are important). Than we will probably be able to tell you what goes amiss where. :ph34r:

Link to comment
Share on other sites

hahah yes i know about showing code and such , i hadnt saved any so i couldnt show any, now this is just for checking if any data is being sent, and by data i mean packets, now it waits and when i attempt to login it does say its found the socket and such but there is never any data thats captured. I set the game IP to connect to localhost so it should be sending all the data through my prog

#include <GUIConstants.au3>
#include <Array.au3>
$LocalIP = "127.0.0.1"
$IP = "64.147.162.103"
$Port = 23000
HotKeySet("{ESC}","quit")
$Form1 = GUICreate("AForm1", 633, 447, 193, 115)
$Edit1 = GUICtrlCreateEdit("", 24, 24, 585, 345)
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
TCPStartup()
Do
$MainSocket = TCPListen($LocalIP,$Port,100)
Until $MainSocket > 0 


while 1
    Sleep(10)
    Do
        $LocalSocket = TCPAccept($MainSocket)
    Until $LocalSocket >= 0
   GUICtrlSetData($Edit1,"Local Connected...Processing Data")
   $Connectedout = TCPConnect($IP,23000)
   While 1
    $recv = TCPRecv($Connectedout,10000)
    If $recv <> "" Then
        GUICtrlSetData($Edit1,$recv)
    EndIf
    WEnd
WEnd
WEnd

Func quit()
    Exit
EndFunc
Edited by thatsgreat2345
Link to comment
Share on other sites

yeah i know i need 3 , i was planning on doing more hahah this was just to see if i could recieve data but if you have aproxy made that can transfer the packets for the 3 IPs, log the packets to a file/real time chatbox and have the option to send packets as well id love you :lmao:

64.147.162.103:23000 Select Server Server IP
64.147.162.99:28000 Select Character Server IP
64.147.162.100:15400 Game Server IP
Edited by thatsgreat2345
Link to comment
Share on other sites

... now it waits and when i attempt to login it does say its found the socket and such but there is never any data thats captured.

Well, I must say that I do not quite understand why you are accepting a connection (into $localsocket) but are not using it.

Suggestion : first see if both a listening-and-receiving connection ($LocalSocket) and an active connection ($Connectedout) work seperatily from each other.

Only after that start thinking about how to connect both together.

That is, if that is actually what you want ....

Reading the response from "dnsi" and your own response to that one I get theidea that you want to accept upto three connections, and echo whatever one transmits to your server to the other two. For just three connections thats not all that difficult (the only "hard" thing is to check if a connection is active, and if not skip it for reception as well as for echoing data to it). :lmao:

Link to comment
Share on other sites

well the point of a proxy is to relay the data being sent through a program, to the actual server so you can capture the packets / send packets, now there are 3 servers and so im trying to recv the data by starting a listening port localy and then a port on the outgoing socket as well so i can recieve the packets on the local port, and send them to the out going socket

Link to comment
Share on other sites

A good way for a bot (Almost EXACTLY what i was doing like seconds ago). Im guessing your proxy will connect then 3 people will connect to your proxy that will get all the same info? thats not too hard. You would do TCPConnect and Listen.

Link to comment
Share on other sites

what i believe to be the problem here is that TCPListen connects to port 23000 yes, but thats the local port, but i believe that it should be listening on a different port such as the local port that is set with the TCPConnect yet i have no clue how to get such a thing , ive been thinking through running cmd doing a netstat -n and then going from there

Link to comment
Share on other sites

What game is it for? Can u change the port of the client?

Link to comment
Share on other sites

well the point of a proxy is to relay the data being sent through a program,

Ah, a proxy. As you say, that should be as simple as receiving data on one port, and than sending it on from another port to the target-server (and vice-verse ofcourse).

A problem could be that you want to be able to connect to three servers, and I have no idea how your game does that.

Steps for a simple, one-server connection proxy :

1) create a listening port on 127.0.0.1 for your local game to connect to.

2) When anything comes in,

. a.) accept the connection

. b.) connect to the actual server

3) Accept data from both sides and send on to the other socket

The code you posted was close. All you needed to do was to implement 3)

Edited by BitRot
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...