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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:59:25+00:00 2026-05-18T20:59:25+00:00

I want to transfer messages from the android device to desktop application. My question

  • 0

I want to transfer messages from the android device to desktop application. My question is that can i connect the android WiFi device with the desktop WiFi device without any use of internet connection. I want to use it just like the Bluetooth. is this possible or not? if it is possible then how can i implement it?

Thanks and Regards
Amit Thaper

  • 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-05-18T20:59:25+00:00Added an answer on May 18, 2026 at 8:59 pm

    Here is an implementation of mreichelt’s suggestion. i looked this up when i had the same problem and figured i’d just post my implementation of the solution. it’s really simple. i also built a java server that listens for incoming requests from the android device (for debugging purposes mostly). here’s the code to send stuff over the wireless:

    import java.net.*;
    import java.io.*;
    import java.util.*;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.ContentValues;
    import android.content.SharedPreferences;
    import android.content.SharedPreferences.Editor;
    import android.os.Bundle;
    import android.util.Log;
    
    
    public class SMSConnection {
            /* The socket to the server */
        private Socket connection;
    
        /* Streams for reading and writing the socket */
        private BufferedReader fromServer;
        private DataOutputStream toServer;
    
        /* application context */
        Context mCtx;
    
        private static final String CRLF = "\r\n";
    
        /* Create an SMSConnection object. Create the socket and the 
           associated streams. Initialize SMS connection. */
        public SMSConnection(Context ctx) throws IOException {
            mCtx=ctx;
            this.open();
            /* may anticipate problems with readers being initialized before connection is opened? */
            fromServer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            toServer = new DataOutputStream(connection.getOutputStream());
        }
    
        public boolean open(String host, int port) {
            try {
                connection = new Socket(host, port);
                return true;
            } catch(IOException e) {
                Log.v("smswifi", "cannot open connection: " + e.toString());
            }
            return false;
        }
    
        /* Close the connection. */
        public void close() {
            try {
                connection.close();
            } catch (IOException e) {
                Log.v("smswifi","Unable to close connection: " + e.toString());
            }
        }
    
        /* Send an SMS command to the server. Check that the reply code
           is what is is supposed to be according to RFC 821. */
        public void sendCommand(String command) throws IOException {
    
            /* Write command to server. */
            this.toServer.writeBytes(command+this.CRLF);
    
            /* read reply */
            String reply = this.fromServer.readLine();
        }
    }
    

    that’s a basic skeleton for a connection class. you simply instantiate the class, and call open on the instance you create with the host and port (don’t forget to close the connection when you’re done) and you can change the body of sendCommand to your liking. i’ve included a read/write operation in the function body as an example.

    here is the code to run a server on a remote machine that listens for connections and spawns a thread to handle each request. it can easily interact with the above code for debugging (or any use).

    import java.io.*;
    import java.net.*;
    import java.util.*;
    
    public final class smsd {
        ///////MEMBER VARIABLES
        ServerSocket server=null;
        Socket client=null;
    
        ///////MEMBER FUNCTIONS
        public boolean createSocket(int port) {
            try{
                server = new ServerSocket(port);
                } catch (IOException e) {
                System.out.println("Could not listen on port "+port);
                System.exit(-1);
            }
            return true;
        }
    
        public boolean listenSocket(){
            try{
                client = server.accept();
            } catch (IOException e) {
                System.out.println("Accept failed: ");
                System.exit(-1);
            }
            return true;
        }
    
        public static void main(String argv[]) throws Exception {
            //
            smsd mySock=new smsd();
    
            //establish the listen socket
            mySock.createSocket(3005);
            while(true) {
                if(mySock.listenSocket()) {
                    //make new thread
                    // Construct an object to process the SMS request message.
                    SMSRequest request = new SMSRequest(mySock.client);
    
                    // Create a new thread to process the request.
                    Thread thread = new Thread(request);
    
                    // Start the thread.
                    thread.start();
                }
            }
    
            //process SMS service requests in an infinite loop
    
        }
    ///////////end class smsd/////////
    }
    
    
    final class SMSRequest implements Runnable {
        //
        final static String CRLF = "\r\n";
        Socket socket;
    
        // Constructor
        public SMSRequest(Socket socket) throws Exception 
        {
            this.socket = socket;
        }
    
        // Implement the run() method of the Runnable interface.
        public void run()
        {
            try {
                processRequest();
            } catch (Exception e) {
                System.out.println(e);
            }
        }
    
        private static void sendBytes(FileInputStream fis, OutputStream os) throws Exception
            {
               // Construct a 1K buffer to hold bytes on their way to the socket.
               byte[] buffer = new byte[1024];
               int bytes = 0;
    
               // Copy requested file into the socket's output stream.
               while((bytes = fis.read(buffer)) != -1 ) {
                  os.write(buffer, 0, bytes);
               }
            }
    
        private void processRequest() throws Exception
        {
            // Get a reference to the socket's input and output streams.
            InputStream is = this.socket.getInputStream();
            DataOutputStream os = new DataOutputStream(this.socket.getOutputStream());
    
            // Set up input stream filters.
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
    
            // Get the request line of the SMS request message.
            String requestLine = br.readLine();
    
            //print message to screen
            System.out.println(requestLine);
    
            //send a reply
            os.writeBytes("200");
    
            // Close streams and socket.
            os.close();
            br.close();
            socket.close();
        }
    }
    

    nb4namingconventions.

    almost forgot. you will need to set these permissions inside the tags in your AndroidManifest.xml in order to use wireless.

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using android-c2dm, and my device successfully receives messages from it. I want
In my java application I want to transfer some Images from client to server.
I want to transfer files between any 2 active users on my website and
I want to transfer data(21M rows) from mysql database to DynamoDB. I am using
I just want to transfer (send or receive) a hash from client to server.
Where does eclipse keep it's key-binding settings? I want to transfer them from one
I want to ask, why I cannot transfer file from server to client? When
I come from Java, and I want to do some data transfer objects (DTOs)
I want to send email messages that have arbitrary unicode bodies in a Python
I want transfer data from MongoDB to SQL Sever using the C# driver. The

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.