'구글'에 해당되는 글 36

  1. 2008.05.31 Google I/O '08 기조연설
  2. 2008.01.31 [펌] 안드로이드 소켓통신
  3. 2008.01.31 [펌] 안드로이드 UDP 내용
Interesting/About Google | Posted by hyena0 2008. 5. 31. 11:44

Google I/O '08 기조연설

Google I/O '08 Keynote speaking

google I/O '08 의 기조연설에서는 Client, Connectivity, and the Cloud 라는 주제로 이야기를 했는데 정리해 보면 아래와 같다. 우선 구글 개발자들이 어떤일을 하고있고 할 것인지를 보여줄 것이라고 하고 각 주제에 대해 전문가가 나와서 얘기해 준다.

1. myspace : 마이스페이스의 웹에서 컨텐츠를 direct search 하는 기능을 데모하는데, 속도가 굉장히 빠른 것을 알 수 있다. 이것은 로컬에 있는 데이터를 액세스하기 때문이라는 설명이다.

2. Android : 안드로이드의 추가된 기능을 설명해 주는데, rock key 기능, 구글맵스, 화면이동 등은 아이폰과 크게 다르게 느껴지지 않는다. 마지막에 보여주는 street view를 3차원 센서와 연동하여 핸드폰을 움직일때 거리가 움직이는 장면은 인상적인데, 관객들 조차 박수로 응답한다.

3. APP engine : 엔진은 offline에서 사용가능하고, rich media 를 다룰 수 있는 특징이 있다.

4. Data APIs : ajax APIs와 control에 대해 얘기하고 youtube 사용하는 방법, 번역기 등을 보여준다.

5. Google Web Toolkit (GWT)
  : 자바소스를 "optimizing cross-complier" 를 이용해서 자바스크립트로 변환하는 툴이다. 자신의 코드를 웹으로 연동하려고 할때에 유용한 툴로 보인다. ajax로 되어 있고, 드로그앤 드롭방식도 지원하고 자바 5이상 사용가능하다.

6. social web : 요즘 증가하는 social web에 대해 설명하고 적용사례를 보여준다.
  적용사례 - hi5 - 음악을 공유하는 사이트
  hi5, orkut, myspace.com, iGoogle, NETLOG, plaxo, imeem, Ning
  추가 -> oracle, yahoo, xing, AOL
 그리고  Google Friend Connect 를 이용해서 social web을 쉽게 구축할 수 있다고 한다.

아래는 기조연설 동영상인데 1시간30분정도 되므로, 느긋하게 보시길...

Interesting/ANDROID | Posted by hyena0 2008. 1. 31. 00:48

[펌] 안드로이드 소켓통신

아래는 참조용으로 www.anddev.org 를 참조했습니다.

자세한 위치는 이곳 입니다.


SocketTest.java

Java:

public class SocketTest extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
       
        Thread sThread = new Thread(new TCPServer());
        Thread cThread = new Thread(new TCPClient());
       
        sThread.start();
        try {
               Thread.sleep(1000);
          } catch (InterruptedException e) { }
       
          cThread.start();
    }
}


TCPServer.java

Java:

public class TCPServer implements Runnable{
     
    public static final String SERVERIP = "127.0.0.1";
    public static final int SERVERPORT = 4444;
         
    public void run() {
         try {
              Log.d("TCP", "S: Connecting...");
             
              ServerSocket serverSocket = new ServerSocket(SERVERPORT);
              while (true) {
                 Socket client = serverSocket.accept();
                 Log.d("TCP", "S: Receiving...");
                 try {
                      BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                      String str = in.readLine();
                      Log.d("TCP", "S: Received: '" + str + "'");
                    } catch(Exception e) {
                        Log.e("TCP", "S: Error", e);
                    } finally {
                         client.close();
                         Log.d("TCP", "S: Done.");
                    }

              }
             
         } catch (Exception e) {
           Log.e("TCP", "S: Error", e);
         }
    }
}


TCPClient.java

Java:

public class TCPClient implements Runnable {

     
    public void run() {
         try {
           
           InetAddress serverAddr = InetAddress.getByName(UDPServer.SERVERIP);
           
           Log.d("TCP", "C: Connecting...");
           Socket socket = new Socket(serverAddr, TCPServer.SERVERPORT);
           String message = "Hello from Client";
               try {
                Log.d("TCP", "C: Sending: '" + message + "'");
                PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())),true);
               
                out.println(message);
                Log.d("TCP", "C: Sent.");
                  Log.d("TCP", "C: Done.");
               
             } catch(Exception e) {
                 Log.e("TCP", "S: Error", e);
                } finally {
                  socket.close();
                }
         } catch (Exception e) {
              Log.e("TCP", "C: Error", e);
         }
    }
}




AndroidManifest.xml

XML:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.e2esp.socket.test">

    <application android:icon="@drawable/icon">
        <activity class=".SocketTest" android:label="@string/app_name">
            <intent-filter>
                <action android:value="android.intent.action.MAIN" />
                <category android:value="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
Interesting/ANDROID | Posted by hyena0 2008. 1. 31. 00:43

[펌] 안드로이드 UDP 내용

아래는 참조용으로 사용합니다.
내용을 참조하시려면 www.anddev.org 를 보세요..
자세한 위치는 이곳 입니다.

----------------------------------------------------------------------------------------------------
 
UDP-Networking - within the Emulator


What you will learn: You will learn how to setup a UDP-Connection within the Emulator.

Question Problems/Questions: Write it right below...

Difficulty: 2 of 5 Smile

What it will look like:
"S:" stands for server, "C:" stands for Client:
Java:
D/UDP(1515): S: Connecting...
D/UDP(1515): S: Receiving...
D/UDP(1515): C: Connecting...
D/UDP(1515): C: Sending: 'Hello from Client'
D/UDP(1515): S: Received: 'Hello from Client'
D/UDP(1515): S: Done.
D/UDP(1515): C: Sent.
D/UDP(1515): C: Done.


Description:
0.) The MainActivity will do nothing, except to start 2 Threads. The first will be the Server waiting for a packet, that will be sent by the second Thread, the Client, 500ms later.
This is the simple MainActivity:
Java:
package org.anddev.android.udpconnection;

import android.app.Activity;
import android.os.Bundle;

public class UDPConnection extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
       
        /* Kickoff the Server, it will
         * be 'listening' for one client packet */

        new Thread(new Server()).start();
        /* GIve the Server some time for startup */
        try {
               Thread.sleep(500);
          } catch (InterruptedException e) { }
          
        // Kickoff the Client
        new Thread(new Client()).start();
    }
}

1.) The Server waiting for one packet.
Java:
package org.anddev.android.udpconnection;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

import android.util.Log;

public class Server implements Runnable {

     public static final String SERVERIP = "127.0.0.1"; // 'Within' the emulator!
     public static final int SERVERPORT = 4444;

     @Override
     public void run() {
          try {
               /* Retrieve the ServerName */
               InetAddress serverAddr = InetAddress.getByName(SERVERIP);

               Log.d("UDP", "S: Connecting...");
               /* Create new UDP-Socket */
               DatagramSocket socket = new DatagramSocket(SERVERPORT, serverAddr);

               /* By magic we know, how much data will be waiting for us */
               byte[] buf = new byte[17];
               /* Prepare a UDP-Packet that can
                * contain the data we want to receive */

               DatagramPacket packet = new DatagramPacket(buf, buf.length);
               Log.d("UDP", "S: Receiving...");

               /* Receive the UDP-Packet */
               socket.receive(packet);
               Log.d("UDP", "S: Received: '" + new String(packet.getData()) + "'");
               Log.d("UDP", "S: Done.");
          } catch (Exception e) {
               Log.e("UDP", "S: Error", e);
          }
     }
}


2.) The Client that sends just one packet to the Server.
Java:
package org.anddev.android.udpconnection;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

import android.util.Log;

public class Client implements Runnable {
     @Override
     public void run() {
          try {
               // Retrieve the ServerName
               InetAddress serverAddr = InetAddress.getByName(Server.SERVERIP);
               
               Log.d("UDP", "C: Connecting...");
               /* Create new UDP-Socket */
               DatagramSocket socket = new DatagramSocket();
               
               /* Prepare some data to be sent. */
               byte[] buf = ("Hello from Client").getBytes();
               
               /* Create UDP-packet with
                * data & destination(url+port) */

               DatagramPacket packet = new DatagramPacket(buf, buf.length, serverAddr, Server.SERVERPORT);
               Log.d("UDP", "C: Sending: '" + new String(buf) + "'");
               
               /* Send out the packet */
               socket.send(packet);
               Log.d("UDP", "C: Sent.");
               Log.d("UDP", "C: Done.");
          } catch (Exception e) {
               Log.e("UDP", "C: Error", e);
          }
     }
}


Regards,
plusminus

_________________
| Android Development Community / Tutorials

----------------------------------------------------------------------------------------------------