Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntp server is not responding at read function call in ntpclient/main.c #7

Open
PravallikaKG opened this issue Jan 7, 2019 · 5 comments

Comments

@PravallikaKG
Copy link

PravallikaKG commented Jan 7, 2019

In ntpclient/main.c program, at read function call the program is hanging and not coming out. Looks like it is not getting response from ntp server.

Same case at recievefrom function call in python script as well.

Could someone give me a hint, for what reason it is hanging?

@PravallikaKG
Copy link
Author

PravallikaKG commented Jan 7, 2019

Also i had changed the li_vn_mode value to 0x23
i.e., *( ( char * ) &packet + 0 ) = 0x23; because current version number is 4.

but still i am not getting response from server. Do i need to any more changes to make it to work>

@lettier
Copy link
Owner

lettier commented Jan 8, 2019

Hello @PravallikaKG,

I pulled and compiled main.c and it works as expected.

Are you able to reach the server specified?

ping -c4 us.pool.ntp.org

You should see something like the following.

PING us.pool.ntp.org

--- us.pool.ntp.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 7ms
rtt min/avg/max/mdev = 66.001/66.107/66.221/0.197 ms

👍

@PravallikaKG
Copy link
Author

PravallikaKG commented Jan 8, 2019

Hi lettier,

yes us.pool.ntp.org ntp server is reachable. yes when i pinged to server following is the output:

ping -c4 us.pool.ntp.org
PING us.pool.ntp.org (199.38.183.232) 56(84) bytes of data.
64 bytes from iad1.m-d.net (199.38.183.232): icmp_req=1 ttl=47 time=253 ms
64 bytes from iad1.m-d.net (199.38.183.232): icmp_req=2 ttl=47 time=254 ms
64 bytes from iad1.m-d.net (199.38.183.232): icmp_req=3 ttl=47 time=253 ms
64 bytes from iad1.m-d.net (199.38.183.232): icmp_req=4 ttl=47 time=256 ms

--- us.pool.ntp.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 253.217/254.194/256.025/1.211 ms

And also i added logs in main.c after connect, write and read function calls. Connection success, write success logs are printed, but program hanged in read call. Because read logs after read call are not printed.

Also which ntp protocol version you have tried? 3 or 4 in code?
i tried with different ntp servers like asia.pool.ntp.org, ntp.pool.org but problem remains same.

Is there any alternate to check why server is not responding to my request from my computer?

@PravallikaKG
Copy link
Author

Problem got resolved. it is because of firewall in my network. Thank you lettier :)

@DG12
Copy link

DG12 commented Jan 10, 2019

Try #1 :Got server address, read sucessful,
Try #2: some few seconds later, got same server address, hung waiting for read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants