Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8631383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:12:45+00:00 2026-06-12T09:12:45+00:00

I’m trying to establish and udp connection between a server and an android device.

  • 0

I’m trying to establish and udp connection between a server and an android device. I have written the server and android client part. When I launch the server on my computer localhost, both server and emulator can communicate with each other very well. However, when I launch the server in cloud, emulator can send udp packets to server but can’t receive any.

So, first thing come to my mind was that there may be some routing issues that prevents the packets to reach to the emulator. Hence, I have used my mobile phone (samsung galaxy s2, ICS) with a 3g connection. However, same thing occured again. My phone can send udp packets but it can’t receive any.

Then, I thought that maybe my machine in cloud can’t send packets. SO, I have sniffed the packets with wireshark and seen that it really sends/receives the udp packets.

I have read many questions about this issue in stackoverflow but I couldn’t come up with a solution. Maybe you guys help me out. Here is the server and client udp send/receive parts of my work. If you need more information, I’m ready to give.

Thanks in advance.

Server (no need to write listening parts ‘cuz no problem with that)

ClientIPAddress = IncomingPacket.getAddress();
ClientPort = IncomingPacket.getPort();
OutToClientSocket = new DatagramSocket();
DatagramPacket PacketToClient = new DatagramPacket(sendBuffer, sendBuffer.length,     ClientIPAddress, ClientPort);
OutToClientSocket.send(PacketToClient);

Client (only listening part)

ServerIP = InetAddress.getByName(MachineName);
DatagramPacket IncomingPacket = new DatagramPacket(buf, buf.length);
MySocket.receive(IncomingPacket);
buf = IncomingPacket.getData();
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:12:46+00:00Added an answer on June 12, 2026 at 9:12 am

    I have solved my problem thanks to @EJP . I was using a datagramsocket for listening packets and using another one to send packets. You have to use 1 socket for both operations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.