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 7979569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:48:41+00:00 2026-06-04T09:48:41+00:00

I am currently developing an android application which requires two devices to communicate over

  • 0

I am currently developing an android application which requires two devices to communicate over TCP (I can’t silently loose packets so UDP is out). I need the communication to be as fast as possible (i.e. I have a low acceptable latency threshold) but the connections will be short lived (likely less than 2min). The phones will connect, do their thing, then close the connection.

I have done quite a bit of research regarding NAT hole punching, but there does not seem to be a reliable tcp hole punching method implemented for java and android. Thus, it seems my only option is to develop a server application which will “proxy” the tcp communications between the two devices.

I have two questions:

1) I don’t want to re-invent the wheel: is there a simple tcp proxy already written I can use? (note: not an http proxy of any sort – because I need low latency I am simply looking to pass a very small payload between the two tcp socket connections on the devices). The sole purpose of the server is to avoid NAT issues.

2) If not, does anyone have experience with this sort of thing and what would they recommend? I have played around with the idea of Java NIO or perhaps a server that creates a new thread for each connection (the problem being how to link the appropriate “client” threads to pass the information back and forth). Or is Java even the best language to use for the server end?

I have read some recommendations of using XMPP via google’s chat services (see here) but I don’t want the overhead of XMPP.

Any direction or suggestions would be greatly appreciated.

  • 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-04T09:48:42+00:00Added an answer on June 4, 2026 at 9:48 am

    As for the direct answers to your questions:

    1) Not a good one I have found, it really depends on what’s available on your server. I did write one some time ago in PHP and was VERY quick and simple and will work with most servers. I used this as a guide http://devzone.zend.com/209/writing-socket-servers-in-php/

    If you can run a compiled C++ binary you could look here, it was an alternative we considered:
    http://tcpproxy.codeplex.com/

    2) see answer to 1 for PHP option, I don’t have experience in writing from scratch in Java.

    As an aside on NAT traversal… I have been investigating the same NAT issue for project I am working on and I found 2 options that would require the NDK but could work well for NAT traversal on Android.
    pjnath (GPL):

    http://www.pjsip.org/pjnath/docs/html

    code.google.com/p/csipsimple/source/browse/trunk/pjsip_android/?r=201

    libnice(LGPL):

    nice.freedesktop.org/wiki/

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

Sidebar

Related Questions

I am currently developing an Android application which has a web backend. I can
I am currently developing an app which will be on Android Market. How can
I'm currently developing an application for Android which needs to use a custom made
I'm currently developping an Android application which connects to a server through TCP. The
I'm currently developing a camera application for Android on which some problems have occurred.
I'm currently developing an Android application that fetches images using http requests. It would
I'm currently developing an android application that uses sockets to connect to a local
I am currently developing an android application using eclipse and I already have a
I'm currently developing the presentation layer of an android app. The api which I'm
I am currently developing an android application and required to get the browser version.

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.