Design of Android mobile phone sign-In Application Server

Source: Internet
Author: User

Recently, my tutor asked me to develop a mobile phone class sign-In application with another student. I am responsible for the communication architecture between the client and the server and data storage.

I have only used compilation and C/C ++ for four years in college, so I still have no idea about andriod development. I spent a week writing basic communication functions.

The first is the server architecture:

 

There are three main types of network communication threads in network communication. One is that the scheduled multicast thread broadcasts the ip address of the host machine in the same LAN to all student machines. Because one AP supports a small number of connections, this is why regular multicast is used. The second is to listen to the thread, accept the tcp connection of the student machine, and then generate a new sign-In Transaction Thread. The third is the Transaction Thread, which processes the student's sign-in information and returns the sign-in status. The database uses Sqlite, which comes with andriod. Because there are a large number of transaction threads, it is necessary to do a good job of thread synchronization.

  wifiManager=          mButton.setOnClickListener(                                mEcho =                 mEcho.setText("begin"                                   TCPListenThread tcpListenThread =                                    MulticastThread multicastThread =                  multicastThread.start();
                Log.i(TAG, "In MulticastThread.run()"             InetAddress address =             multicastSocket =                           ( i = 0; i != 100; ++                 String msg = "I'm the teacher, my IP Address is?" +                 [] buf =                                  DatagramPacket packet=                  Thread.sleep(1000          }          }           }            .run();
             Log.i(TAG, "In TCPListenThread.run()"                      listenSocket =              (                 CheckinSocket =                                  CheckinThread checkinThread =             }                 }
            Log.i(TAG, "In CheckinThread.run()"                       InputStreamReader input =  InputStreamReader( checkinSocket.getInputStream(),"UTF-8"              [] b =  [1024             StringBuilder builder =                           (( i = input.read(b)) != -1               String msg =             Log.i(TAG, "In CheckinThread.run() msg:"+                        }                 }

After testing with multiple hosts, the server can work normally. However, since I only have one week of development experience in Android, the code in the server will inevitably have deficiencies and bugs. I hope you can point it out. Thank you ~~

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.