Connect Directly to Network Sockets
Network sockets are endpoints in connections across a computer network. Direct socket communication is used for lower-level interactions with network and internet connections. While most users' needs will be fulfilled by the higher-level Web Operations, raw socket connections are also an option.
Open a socket.
In[1]:=
sock = SocketConnect[{"wolfram.com", 80}]
Out[1]=
Write a request on the socket.
In[2]:=
WriteString[sock, "GET /index.php HTTP/1.0 \n\n"]
Read the response.
In[3]:=
StringTake[ReadString[sock], 200]
Out[3]=
Close the socket.
In[4]:=
Close[sock]
Out[4]=