E1M1 Posted April 9, 2010 Share Posted April 9, 2010 (edited) Hello, I made my own UDP server. It works fine If I send packets to 192.168.255.128 but for some reason it doesn't work if I send packets to 90.191.143.* then packet doesn't reach to my udp server. I have set router forward port 65532 to 192.168.255.128 but still doesn't work. I have other running servers and these can be accessed with no problems. Nonly problem I have is with my UDP server which is 100% copy-paste from help. Only diference is that i replaced $socket = UDPBind("127.0.0.1", 65532) with $socket = UDPBind("0.0.0.0", 65532) will this be problem? any suggestions? Edited April 9, 2010 by E1M1 edited Link to comment Share on other sites More sharing options...
E1M1 Posted April 10, 2010 Author Share Posted April 10, 2010 Any one? I just used examples from hel, Can't find whi it doesn't work with remote IP. edited Link to comment Share on other sites More sharing options...
trancexx Posted April 10, 2010 Share Posted April 10, 2010 Do you know what server is? How do you know packet doesn't reach your server? Is server really yours or is it maybe theirs? If it's yours how can it be on that remote IP? Why are you port forwarding? Do you know anything about UDP protocol beside its name? From hel or from hell? ...I have few more questions, but don't want to put additional pressure on you. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
E1M1 Posted April 10, 2010 Author Share Posted April 10, 2010 Do you know what server is?How do you know packet doesn't reach your server?Is server really yours or is it maybe theirs?If it's yours how can it be on that remote IP?Why are you port forwarding?Do you know anything about UDP protocol beside its name?From hel or from hell?...I have few more questions, but don't want to put additional pressure on you.Yes, I know the IP and port.I think that packet doesn't reach to server because otherwise server would react.And yes I have control over it, I added port forwarding rule in router.As I mentioned above I copied UDP example server from Autoit help and only thing I changed was listening IP (127.0.0.1 to 0.0.0.0)And to send packets I copied UDPSend() script from help. and changed IP.What I don't understand is that if I Use VMware as server then server script receives packets. But If i try send packets to that real remote server then it doesn't do anything. So what I do is moving same script from VMware to remote server, only diference is that servers that runs on VMwae (which uns on same computer) reacts if it sees packet, but the server that if far away from my home doen't react.I have physical access to remote server if needed.I know basics about networking. I know that ports need to be opened and forwarded in order to get send packets edited Link to comment Share on other sites More sharing options...
Developers Jos Posted April 10, 2010 Developers Share Posted April 10, 2010 (edited) As I mentioned above I copied UDP example server from Autoit help and only thing I changed was listening IP (127.0.0.1 to 0.0.0.0)And to send packets I copied UDPSend() script from help. and changed IP.Since you know the network basics: Do you think that 0.0.0.0 is seen as a valid IP address and that the UDPBind function returns a proper Socket and no errors? Jos Edited April 10, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 10, 2010 Share Posted April 10, 2010 Since you know the network basics: Do you think that 0.0.0.0 is seen as a valid IP address and that the UDPBind function returns a proper Socket and no errors? JosI bind to 0.0.0.0 all the time. Why wouldn't it work? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 10, 2010 Developers Share Posted April 10, 2010 I bind to 0.0.0.0 all the time. Why wouldn't it work?True, it is a valid Broadcast address, not so sure it will serve the OP's purpose... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
trancexx Posted April 10, 2010 Share Posted April 10, 2010 Some time ago I wrote a script that communicates with specific servers using UDP protocol. Purpose is to retrieve mx records (or any other for that matters) for some domain. Script is in examples.Cleaner version can be found in script named Mailer.au3, also in examples.This is one part of that code: expandcollapse popup$sDomain = "google.com" ConsoleWrite(_MXQueryServer($sDomain) & @CRLF) Func _MXQueryServer($sDomain) Local $aDomain = StringSplit($sDomain, ".", 3) Local $sQueryDomain For $i = 0 To UBound($aDomain) - 1 $sQueryDomain &= Hex(BinaryLen($aDomain[$i]), 2) & Hex(Binary($aDomain[$i])) Next $sQueryDomain &= "00" Local $iIdentifier = Hex(Random(0, 255, 1), 2) Local $bQuery = Binary("0x00" & $iIdentifier & "01000001000000000000" & $sQueryDomain & "000F0001") Local $aSocket Local $bRcvData UDPStartup() For $iRound = 1 To 8 Local $sServer Switch $iRound Case 1 Local $aLocalServer = StringSplit(RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "DhcpNameServer"), " ", 1) If $aLocalServer[0] Then If StringLeft($aLocalServer[1], 3) <> "192" Then $sServer = $aLocalServer[1] EndIf EndIf Case 2 $sServer = "4.2.2.3" Case 3 $sServer = "4.2.2.4" Case 4 $sServer = "208.67.222.222" Case 5 $sServer = "208.67.220.220" Case 6 $sServer = "4.2.2.5" Case 7 $sServer = "4.2.2.6" Case 8 Return SetError(1, 0, 0) EndSwitch If $sServer Then $aSocket = UDPOpen($sServer, 53) If @error Or $aSocket[0] = -1 Then UDPCloseSocket($aSocket) ContinueLoop EndIf UDPSend($aSocket, $bQuery) For $i = 1 To 5 $bRcvData = UDPRecv($aSocket, 512, 1) If $bRcvData Then ExitLoop Sleep(100) Next If $bRcvData And Hex(BinaryMid($bRcvData, 2, 1)) = $iIdentifier Then UDPShutdown() Return $bRcvData EndIf EndIf Next UDPShutdown() Return SetError(2, 0, 0) EndFuncAm I port forwarding or maybe binding? Where did that console output came from, thin air?Btw, E1M1 doesn't know what server is. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
E1M1 Posted April 11, 2010 Author Share Posted April 11, 2010 (edited) Btw, E1M1 doesn't know what server is.Server is computer which stands in server's room and which hosts services. And people ton't physically totch server.But I called server cumputer where I hosted script on.Edit1: What I need to change in my client script? Your code was quite complicated. Edited April 11, 2010 by E1M1 edited 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