Jump to content

Need some help with packets


Recommended Posts

Hey.. I've tried to figure out how the TCP cmds works.. But i couldn't figure it out in the help file. So i'd be happy if someone just could give me a short ex. How to send lets say a packet "287537" to the server "123.43.234.25:2053" (Is a port needed?) And then i need to know if there's any way to find the server i'm on. I know the port but not the server.

-XInFisk

Link to comment
Share on other sites

A modified version of the client from the AutoIt3 help file using the IP and port u gave:

; Start The TCP Services
;==============================================
TCPStartUp()

; Set Some reusable info
;--------------------------

Dim $szIPADDRESS = "123.43.234.25"
Dim $nPORT = 2053


; Initialize a variable to represent a connection
;==============================================
Dim $ConnectedSocket = -1


;Attempt to connect to SERVER at its IP and PORT 33891
;=======================================================
$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)


Dim $szData

; If there is an error... show it
If @error Then
    MsgBox(4112,"Error","Unable to connect to the server")
; If there is no error loop an inputbox for data
;   to send to the SERVER.
Else
;Loop forever asking for data to send to the SERVER
    While 1
 ; InputBox for data to transmit
        $szData = InputBox("Data for Server",@LF & @LF & "Enter data to transmit to the SERVER:")
        
 ; If they cancel the InputBox or leave it blank we exit our forever loop
        If @error Or $szData = "" Then ExitLoop
        
 ; We should have data in $szData... lets attempt to send it through our connected socket.
        TCPSend($ConnectedSocket,$szData)
        
 ; If the send failed with @error then the socket has disconnected
 ;----------------------------------------------------------------
        If @error Then ExitLoop
    WEnd
EndIf

TCPCloseSocket($ConnectedSocket)

The port is needed. What do you mean "find" the server your on? If your trying to find the IP address of for example a online game, use your fire wall. If it's a good fire wall, it should list all the connections to your computer. If not, you can download a packet sniffer.

Hallman

Edited by Hallman
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...