Create Socket.
String host ="playandworkandroid.blogspot.com"; sk = new Socket(host, 80);I prepare for send data and receive data.
rBuffer = new BufferedReader(new InputStreamReader(sk.getInputStream())); wBuffer = new BufferedWriter(new OutputStreamWriter(sk.getOutputStream()));I make http Get messeage . and Send it!
wBuffer.write("GET / HTTP/1.1\n"); wBuffer.write("host : " + host + "\n"); wBuffer.write("\n"); wBuffer.flush();If it receive data, print console.
while((readLine = rBuffer.readLine()) != null) { Log.d("HttpGetActivity", readLine); }I got my blog page.
Source code is here.
0 件のコメント:
コメントを投稿