• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am sending my UDP but can not receive

 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am sending my simple string values as UDP data from my pc to another pc(both we have proper java envroment and correct code) and vice versa, but either me and he can not receive the udp. my(and his) port forever waitng with loops from the udp data each of our pc, when other side send me, it can not received....all same port..

but when i send and receive local pc, it is no problem....

what's the problem here?


 
Jon Avadis
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Do you have a piece of code to receive the packet?

Something like




Because in the code you posted, you only send a packet and then close the socket. Theres no receiving going on...

 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jon Avadis wrote:Hi

Do you have a piece of code to receive the packet?

Something like




Because in the code you posted, you only send a packet and then close the socket. Theres no receiving going on...




hello,

there are receiving code:



then, please, give me the solution..

thank you...
 
Todd Buell
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you are sending in the displayed code you are sending to port 7776. When you listen on the remote system, are you listening on the correct port?
 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Todd Buell wrote:When you are sending in the displayed code you are sending to port 7776. When you listen on the remote system, are you listening on the correct port?


sorry., it is same port.

although that i still can not listen...
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our Sockets / Internet Protocols forum.
 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any solutions?

or need any udp hole punching?

pzl, help me.......thanks
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to nitpick, but UseRealWords: "please", not "pzl".
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joldas Nursoltan wrote:any solutions?

or need any udp hole punching?

pzl, help me.......thanks


- Is the sender on the same subnet as the receiving machine? Sender IP address should be something like 124.126.176.x if subnet is 255.255.255.0. Normally, routers are configured to prevent UDP across subnets.

- If you have multiple network interfaces on the receiving machine, then perhaps InetAddress.getLocalHost() is resolving to a IP address on another network interface than the one you're sending to. Check value returned by getLocalHost().

- If both are ok, then perhaps one or both machines have firewalls preventing traffic on that subnet and port?
 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Shiraly wrote:
Joldas Nursoltan wrote:any solutions?

or need any udp hole punching?

pzl, help me.......thanks


- Is the sender on the same subnet as the receiving machine? Sender IP address should be something like 124.126.176.x if subnet is 255.255.255.0. Normally, routers are configured to prevent UDP across subnets.

- If you have multiple network interfaces on the receiving machine, then perhaps InetAddress.getLocalHost() is resolving to a IP address on another network interface than the one you're sending to. Check value returned by getLocalHost().

- If both are ok, then perhaps one or both machines have firewalls preventing traffic on that subnet and port?


thank you...
NAT = Network address translation

1- i am and the remote computer are not under the same NAT, he is on another different NAT on the another city...the sende and receiver not LAN; local area network....

2 - my address.getHostAddress() printed 192.168.0.101, not printed real ip address as above,....

i am and he is also unabled firewall, then tried...but does not work...

i am waiting any response....thank you

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joldas Nursoltan wrote:1- i am and the remote computer are not under the same NTA, he is on another different NTA on the another city...the sende and receiver not LAN; local area network....


I'm sorry, I don't really understand that. But if it means you are trying to send UDP over the internet, then no, that isn't going to work.
 
Joldas Nursoltan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
Joldas Nursoltan wrote:1- i am and the remote computer are not under the same NTA, he is on another different NTA on the another city...the sende and receiver not LAN; local area network....


I'm sorry, I don't really understand that. But if it means you are trying to send UDP over the internet, then no, that isn't going to work.


yes, send onver internet, between any computer on the internet, example, from you to me, or frm me to you...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic