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

  • Home
  • SEARCH
  • 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 8390263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:56:13+00:00 2026-06-09T18:56:13+00:00

I have five domain server and i want to connect to that server using

  • 0

I have five domain server and i want to connect to that server using java socket programming in my android application.

Here my servers
“ANY1.g%%%%%%%%.dk”
“ANY2.g%%%%%%%%.dk”
“ANY3.g%%%%%%%%.dk”
“ANY4.g%%%%%%%%.dk”
“ANY5.g%%%%%%%%.dk”

So when I ping to any of server via ping command in run prompt, it is working perfect and getting response.

but when i am trying to crate socket using this server it gives me “Unknown Host” error.

Here is my code:

try
{
    hostname = "ANY SERVER DOMAIN NAME";
    port = ANY;
    socket = new Socket(hostname, port);
    socket.setReceiveBufferSize(2048);
    socket.setKeepAlive(true);
    Log.e("SOCKET",socket.isConnected());
}
catch(Exception e)
{
    Log.e("ERROR",e.getMessage());
}

Is there any problem with code or any suggestion will be accepted?

Menifest file :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.siliconithub.android.greencall"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.SEND_SMS" />

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:resizeable="true"
    android:smallScreens="true" />

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_app_icon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".GreenCall"
        android:label="@string/title_activity_green_call"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".RecentCallActivity"
        android:label="@string/title_activity_recentcall"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".RecentCallDetailActivity"
        android:label="@string/title_activity_recentcall_detail"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".FavouritesActivity"
        android:label="@string/title_activity_fovourites"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".ContactsActivity"
        android:label="@string/title_activity_contacts"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".ContactDetailsActivity"
        android:label="@string/title_activity_contactdetails"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".TelnetServerActivity"
        android:label="@string/title_activity_telnetserver"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
    <activity
        android:name=".SettingActivity"
        android:label="@string/title_activity_setting"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black" >
    </activity>
    <activity
        android:name=".SearchContactsActivity"
        android:label="@string/title_activity_search_contacts"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>

    <service
        android:name=".UpdateStatusService"
        android:label="@string/title_service_update_status"
        android:icon="@drawable/ic_app_icon"
        android:enabled="true" />

    <receiver android:name=".PhoneStateBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>
</application>
</manifest>

thank you.

  • 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-09T18:56:14+00:00Added an answer on June 9, 2026 at 6:56 pm
    import java.net.Socket;
    public class Main {
        public static void main(String[] args) {
            try {
                Socket socket = new Socket("%%%%.%%%%%.dk", PORT NUMBER);
                socket.setReceiveBufferSize(2048);
                socket.setKeepAlive(true);
                System.out.println("socket " + socket.isConnected());
            } catch (Exception e) {
                System.out.println("error " + e.getMessage());
            }
        }
    }
    

    This returns

    socket true
    

    In Java (no Android). It also works in Android (sherpya has tested it – see his comment below). I guess there is something wrong with your permissions. Can you show us your manifest?

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

Sidebar

Related Questions

So I have these five buttons that I want to be always present in
I have five tables and i want to get result out of them. Here
I have five map reduce that I am running each separately. I want to
I have five links that I want to change the content in the same
I have five buttons on one form that when clicked enables a bool each
I have five activities/screens that I would like to be able to swipe between,
I have five tables that are fairly similar in structure but different enough that
We have a Spring application that uses Apache DBCP for connection pooling. Our app
i have five forms in my c# project. one host an httplistener that i
I have five SWF files that are loaded into a main SWF. All five

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.