DUNGYEUANH Posted October 27, 2012 Posted October 27, 2012 (edited) I'm learning how to use the functions related to TCP, here is a script used to derive the source code of google.com but it does not return anything, can someone help me!!! Global $MainSocket Local $MaxLength = 512000 Local $Server = "173.194.38.161" Local $Port = "80" TCPStartup() $MainSocket = TCPConnect($Server, $Port) If $MainSocket = -1 Then Exit MsgBox(16, "Error", "Unable to connect.") $sData = "474554202F20485454502F312E310D0A0D0A4163636570743A20696D6167652F6769662C20696D6167652F6A7065672C20696D6167652F706A7065672C20696D6167652F706A7065672C206170706C69636174696F6E2F782D73686F636B776176652D666C6173682C202A2F2A0D0A4163636570742D4C616E67756167653A20656E2D75730D0A557365722D4167656E743A204D6F7A696C6C612F342E302028636F6D70617469626C653B204D53494520382E303B2057696E646F7773204E5420352E313B2054726964656E742F342E303B202E4E455420434C5220322E302E3530373237290D0A4163636570742D456E636F64696E673A20677A69702C206465666C6174650D0A436F6E6E656374696F6E3A204B6565702D416C6976650D0A486F73743A207777772E676F6F676C652E636F6D2E766E0D0A0D0A" TCPSend ($MainSocket, $sData) While 1 $Data = TCPRecv($MainSocket, $MaxLength) If @error Then ExitLoop If $Data <> "" Then MsgBox(0, "Received Packet", $Data) EndIf WEnd TCPShutdown() Edited October 27, 2012 by DUNGYEUANH
caleb41610 Posted October 27, 2012 Posted October 27, 2012 (edited) What's the other script consist of?$Server looks like a public IP, have you forwarded the port?Not sure if this will help, but here's my TCP example, it shows how to do multiple connections also has a LOT of comments, check it out too Edited October 27, 2012 by caleb41610 Multi-Connection TCP Server
DUNGYEUANH Posted October 27, 2012 Author Posted October 27, 2012 It automatically forwarded to google.com.vn with the ip: "74.125.235.31"
DUNGYEUANH Posted October 27, 2012 Author Posted October 27, 2012 (edited) I have found errors,thank you Edited October 27, 2012 by DUNGYEUANH
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