salter Posted February 12, 2007 Posted February 12, 2007 hey there im trying to make a udp server for an app i made, so when they start the app they have to login to the server with an account. i can make it work on my computer using my ip on both the app and the server but im wondering if you can do the udp bind without knowing the persons ip address and if so how then any help is appreciated thx
The Kandie Man Posted February 12, 2007 Posted February 12, 2007 (edited) im wondering if you can do the udp bind without knowing the persons ip addressNo, you can't. You have to have the person, whose IP address you don't know, connect to your server which has a static IP address that doesn't change. You could then hard code your server's IP address into the client script and then the client would always know where to look to find the server. If your server is going to change IP addresses frequently, then i would recommend using a web site that the client can connect to and get the IP address of the server. You could then update the site every time the server's IP address changes and the client would therefore always be able to connect to the server. Or you could just set up your own DNS server which is kind of what i just said. Edited February 12, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
salter Posted February 12, 2007 Author Posted February 12, 2007 the server ip isnt changing i just dont know the ip of the client
spyrorocks Posted February 12, 2007 Posted February 12, 2007 well, if im reading your post right, try @ipaddress1 in the place where your supposto put a ip address. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
The Kandie Man Posted February 12, 2007 Posted February 12, 2007 the server ip isnt changing i just dont know the ip of the clientSo have the client connect to the server, not the other way around. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
salter Posted February 13, 2007 Author Posted February 13, 2007 how do i do that, i dont understand how the UDP functions work
Moderators SmOke_N Posted February 13, 2007 Moderators Posted February 13, 2007 how do i do that, i dont understand how the UDP functions workDeja vu? ... Could have swore I saw that same exact question earlier (the delete original post + re-post same question so it doesn't seem like your desperately bumping kind of bump)? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
salter Posted February 18, 2007 Author Posted February 18, 2007 ok well is this how you do it? Client: ;;This is the UDP Client ;;Start the server first ; Start The UDP Services ;============================================== UDPStartup() ; Open a "SOCKET" ;============================================== $socket = UDPOpen(@IPAddress1, 65532) If @error <> 0 Then ExitoÝ÷ Ù'«½êÚºÚ"µÍÈÝHQÙXÙÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBQÝ BÈ[ÈHÓÐÒÑUÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÌÍÜÛØÚÙ]HQ[ YÜÌK MLÌBYÜ ÉÝÈ[^]ÌÍÛH
The Kandie Man Posted February 19, 2007 Posted February 19, 2007 That is part of it. Why do you want to use UDP anyway? UDP is much harder to use and work with than TCP. TCP transfers data in a connection oriented way with error correction and flow control. Why would you want to use UDP which is connectionless, has no flow control, and relies on the Application Layer of the OSI model for error correction. You have to then write your own error correction routines which would encapsulate each packet with a header and trailer in addition to adding a hash that allows the receiving computer to check if the data it received is in tact. Then if it isn't in tact, you would have to devise a way to have the receiving computer send a message back to the sending computer to have it resend that packet. It just seems like a huge annoyance to me. If you need help, Autoit Smith wrote a great little tutorial on how to use TCP and it is on the forum. I don't recall where, but he wrote it. A search for TCP with his name and him as the original poster would probably yield the correct topic fairly quickly. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
salter Posted February 28, 2007 Author Posted February 28, 2007 ok so i run this server on my friends computer: UDPStartup() ; Bind to a SOCKET ;============================================== $socket = UDPBind(@ipaddress1, 65532) If @error <> 0 Then Exit $n = 0 While 1 $data = UDPRecv($socket, 50) $CheckData = StringSplit($data, "|") If Not @Error Then For $x = 1 to $Accounts[0] $AccRecord = StringSplit($Accounts[$x], "|") If Not @Error Then If $CheckData[1] = $AccRecord[2] And $CheckData[2] = $AccRecord[3] Then $Exist = 1 MsgBox(64,"User", "User Exists") ExitLoop Else $Exist = 0 MsgBox(64,"User", "User doesnt Exists") EndIfoÝ÷ Ù©Ý¢y²r©º×«»§¶'§µ«¢+ÙUAMÑÉÑÕÀ ¤((ì=Á¸ÅÕ½ÐíM= -PÅÕ½Ðì(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô((ÀÌØíͽÐôUA=Á¸ ÅÕ½Ðí5äÉ¥¹Ì%@ÉÍÌ!ÉÅÕ½Ðì°ØÔÔÌȤ)%ÉɽȱÐìÐìÀQ¡¸á¥Ð((ÀÌØí¸ôÀ)]¡¥±Ä($ÀÌØí ½Ñ½Õ¹ÐôU% ÑɱI ÀÌØí½Õ¹Ð¤($ÀÌØí ½ÑAÍÌôU% ÑɱI ÀÌØíAÍ̤($ÀÌØíµÍôU%Ñ5Í ¤(%%ÀÌØíµÍôÀÌØí ¡¬Q¡¸($$ÀÌØíÍÑÑÕÌôUAM¹ ÀÌØíͽаU% ÑɱI ÀÌØí½Õ¹Ð¤µÀìÅÕ½ÐíðÅÕ½ÐìµÀìU% ÑɱI ÀÌØíAÍ̤µÀìÅÕ½ÐíðÅÕ½ÐìµÀìÅÕ½Ðí=,ÅÕ½Ðì¤($%%ÀÌØíÍÑÑÕÌôÀQ¡¸($$%5Í ½à À°ÅÕ½ÐíII=HÅÕ½Ðì°ÅÕ½ÐíÉɽÈÝ¡¥±½¹¹Ñ¥¹ÅÕ½ÐìµÀìÉɽȤ($$%á¥Ð($%¹%($%M±À ÄÀÀÀ¤($$ÀÌØíIÍÁ½¹ÍôUAIØ ÀÌØíͽаÔÀ¤($%%ÀÌØíIÍÁ½¹ÍôÅÕ½ÐíÁÑÅÕ½ÐìQ¡¸($$%U%MÑMÑÑ¡M]}!%¤($$%5¥¹U$ ¤($%¹%($%%ÀÌØíIÍÁ½¹ÍôÅÕ½Ðí¹¥ÅÕ½ÐìQ¡¸($%¹%($%%ÀÌØíIÍÁ½¹ÍôÅÕ½Ðíá¥ÐÅÕ½ÐìQ¡¸($$%á¥Ð($%¹%(%¹% i can get it working if i run bot the server and the client on my computer using the "127.0.0.1" as the ip but when i try and connect to the server when its running on a diff computer it does nothing at all. anyone know whats wrong?
The Kandie Man Posted February 28, 2007 Posted February 28, 2007 You didn't explain where this other computer you are connecting from is located. Is it on a LAN, on the other side of the country, or what? I suspect that you are using the wrong IP to connect. If not, and you are connecting through the internet and through a router, you may not have port forwarding enabled. I don't know what else to say, other than you are probably not using the correct IP to connect. If you are on a LAN, connect using the local area network address. If it is a WAN, you have to connect using the WAN IP address. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
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