MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

examples/iosockstream_ex.cpp:22–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using namespace dlib;
21
22int main()
23{
24 try
25 {
26 // Connect to Google's web server which listens on port 80. If this
27 // fails it will throw a dlib::socket_error exception.
28 iosockstream stream("www.google.com:80");
29
30 // At this point, we can use stream the same way we would use any other
31 // C++ iostream object. So to test it out, let's make a HTTP GET request
32 // for the main Google page.
33 stream << "GET / HTTP/1.0\r\n\r\n";
34
35 // Here we print each character we get back one at a time.
36 while (stream.peek() != EOF)
37 {
38 cout << (char)stream.get();
39 }
40 }
41 catch (exception& e)
42 {
43 cout << e.what() << endl;
44 }
45}
46
47

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected