Thatsgreat2345 Posted October 14, 2006 Share Posted October 14, 2006 (edited) Quick question on TCPListen , im making a proxy for a game and was curious as to with TCPListen do we plug in the local port to listen on or the remote port? definatly local, but if its local then how do you connect to a remote port :-/ Edited October 14, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
BitRot Posted October 14, 2006 Share Posted October 14, 2006 ... 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" ? 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! ) the connection so you can talk (TCPRecv TCPSend) with whomever contacted you.Hope that helps. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 14, 2006 Author Share Posted October 14, 2006 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 More sharing options...
BitRot Posted October 14, 2006 Share Posted October 14, 2006 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 .... 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. 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. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 14, 2006 Author Share Posted October 14, 2006 (edited) 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 expandcollapse popup#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 October 14, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
dnsi Posted October 14, 2006 Share Posted October 14, 2006 Your script can only connect 1 client. TO make an multiplayer game to need more than 3 so you need another great program like visual basic to work. I can give you a visualbasic server that i made that can handle up to 299 connection at a time. My Programs:Flip-Flop File Encryption SysyemMULTIPLAYER-SOCKETSERVERHide An Archive In A Picture Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 14, 2006 Author Share Posted October 14, 2006 (edited) 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 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 October 14, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
BitRot Posted October 14, 2006 Share Posted October 14, 2006 ... 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). Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 14, 2006 Author Share Posted October 14, 2006 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 More sharing options...
McGod Posted October 14, 2006 Share Posted October 14, 2006 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. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 15, 2006 Author Share Posted October 15, 2006 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 More sharing options...
McGod Posted October 15, 2006 Share Posted October 15, 2006 What game is it for? Can u change the port of the client? [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 15, 2006 Author Share Posted October 15, 2006 (edited) its for flyff but no i cant change the port as the local port is random like always but the out going port is set in stone Edited October 15, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
BitRot Posted October 15, 2006 Share Posted October 15, 2006 (edited) 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 server3) Accept data from both sides and send on to the other socketThe code you posted was close. All you needed to do was to implement 3) Edited October 15, 2006 by BitRot Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now