0

I want to write JAVA Socket code to query Yahoo Finance: for example: A request for a stock quote for ABCD is translated to a socket connection of : http://finance.yahoo.com/q?s=abcd

I have write the sockcat object with the port 80, What Get statement should I sent to this socket to get the quote of stock "abcd"?

sickcat
  • 11
  • 1
  • 2

1 Answers1

0

You're going to have hard times using sockets for HTTP communication. The socket you created is a TCP socket, and TCP is an OSI Level 4 protocol. HTTP in contrast is, well, OSI Level 7. It is perfectly possible to get a web page via a socket, but you will have to reinvent some stuff from levels 5, 6 and 7.

If you want this for some (educational) reasons, then please consider reading literature about TCP, HTTP and sockets before you proceed.

If you just need the task done, then use the appropriate instruments.

Community
  • 1
  • 1
u354356007
  • 3,024
  • 13
  • 24