You can also sent header(s) by doing this:
GeSHi (java):
s =
new Socket("google.com",
80);
p.print("GET /search?q="+query+" HTTP/1.0\r\n");
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");
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.