September 03, 2010, 11:54:40 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: socket Connection  (Read 1313 times)
0 Members and 1 Guest are viewing this topic.
jazz2k8
Yo Maaan Cheer Up...
Member
*

Reputation: 0
Offline Offline
Posts: 82
Referrals: 0

WWW Awards
« on: January 06, 2009, 08:11:37 AM »

How server will receive HTTP request & send HTTP response i.e using Sockets???

Can you give any sample code for Socket Connection...thanks in advance
Logged

visit my blog: www.yoteam.co.cc
Javaforums.net :: a community about Java software development.
« on: January 06, 2009, 08:11:37 AM »

Your Ad Here
 Logged
jurka
Staff
Member
*
*

Reputation: 5
Offline Offline
Posts: 188
Referrals: 0

Awards
« Reply #1 on: January 06, 2009, 08:55:42 AM »

I haven't learned this part of java much, but the best and simplest example what i have found is http://www.devhood.com/tu...ails.aspx?tutorial_id=396. There are also some examples.
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #2 on: January 06, 2009, 10:44:20 AM »

I haven't learned this part of java much, but the best and simplest example what i have found is http://www.devhood.com/tu...ails.aspx?tutorial_id=396. There are also some examples.

You can also sent header(s) by doing this:

Code
GeSHi (java):
  1. s = new Socket("google.com",80);
  2. PrintStream p = new PrintStream(s.getOutputStream());
  3. p.print("GET /search?q="+query+" HTTP/1.0\r\n");
  4. p.print("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n");
  5. p.print("Connection: close\r\n\r\n");
Created by GeSHI 1.0.7.20

This is how i did it in my java google search application to search in google.
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
jazz2k8
Yo Maaan Cheer Up...
Member
*

Reputation: 0
Offline Offline
Posts: 82
Referrals: 0

WWW Awards
« Reply #3 on: January 07, 2009, 02:29:24 AM »

Thanks ...this forum is helping me alot..10q guys..

Logged

visit my blog: www.yoteam.co.cc
Javaforums.net :: a community about Java software development.
   

 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.295 seconds with 37 queries.

Google visited last this page Today at 12:31:59 PM