Jump to content
Sign in to follow this  

Issues with UDPOpen & UDPRecv

Recommended Posts


Hello people.

I am making a communication app which pokes the server for response. And afterwards the communication begins.

So I am using UDPOpen to create a socket to poke, and UDPRecv to listen. The problem is UDPRecv lags behind, since it waits for data for 100ms. I use the first packet arrival time as some sort of ping. So miliseconds are important here.

A similar issue has been solved here.
'?do=embed' frameborder='0' data-embedContent>>

My issue is a bit different though. I need to connect via UDPOpen and not to localhost, so I cannot know the local port for the socket.

Here comes the questions;
1- From Autoit Help, UDPOpen; "Returns an array : $array[1] contains the real socket"
What does it mean by "real socket"?

2- Is there a way to find out the local port for a socket? If so how?

Note; Server program is not mine, so I cannot change the way it behaves.

Thanks in advance.

Share this post

Link to post
Share on other sites

Hi hiredblade

perhaps >this may be of interest to you

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post

Link to post
Share on other sites

1: The real socket is the socket used for communication. You don't need to know much about it, if you are using AutoIt. For more information read in Wikipedia or some tutorials like this one: http://www.binarytides.com/winsock-socket-programming-tutorial/

2: Try to use my socket UDF:

There is a function called _GetLocalPort($iSocket).

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post

Link to post
Share on other sites

Thank you guys

I will need some time to study and understand your suggestions.

Also, using winsock dll directly can solve my problem, and thanks to funkey I do not have to write an UDF myself.
I consider this solved.

Edited by hiredblade

Share this post

Link to post
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
Sign in to follow this