https://github.com/gotz1480/websocket-client
A simple web client which sends HTTP/1.1 GET requests given a hostname/IPv4 address and port. Implemented using websocket.h library from C/Unix.
https://github.com/gotz1480/websocket-client
c-webclient websocket-client websocket-library websockets
Last synced: 2 months ago
JSON representation
A simple web client which sends HTTP/1.1 GET requests given a hostname/IPv4 address and port. Implemented using websocket.h library from C/Unix.
- Host: GitHub
- URL: https://github.com/gotz1480/websocket-client
- Owner: gotz1480
- Created: 2021-10-13T03:14:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-13T20:44:07.000Z (over 3 years ago)
- Last Synced: 2025-04-04T13:13:21.067Z (2 months ago)
- Topics: c-webclient, websocket-client, websocket-library, websockets
- Language: C
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# websocket-client
A simple web client which sends HTTP/1.1 GET requests given a hostname/IPv4 address and port and then prints the responses (if more than one, chunked) on screen as well as server data (name, aliases, IPv4 addresses and IPv6 addresses). Implemented using websocket.h library from C/Unix.Compilation: ``` gcc client.c -o client.o ```
Usage:
- Using hostname: ``` ./client.o -hostname www.example.com -port 80 ```
- Using IP address (IPv4): ``` ./client.o -ipaddr 74.6.231.21 -port 80 ```The last example sends a GET request to www.yahoo.com.
In both examples the default port for internet traffic is utilized (PORT 80).
Example of output (www.example.com:80):
```
Method: -hostname
Creating socket ...
Socket created!
Connecting to server www.example.com...
name: www.example.com
IPv4 address: 93.184.216.34
IPv6 address: 5db8:d822::
Connected!
Request:
GET / HTTP/1.1
Host:www.example.com:80
Connection: closeSending request ...
---------------------------------------------------------------Response 0:
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 488150
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Wed, 13 Oct 2021 03:21:56 GMT
Etag: "3147526947"
Expires: Wed, 20 Oct 2021 03:21:56 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (agb/A445)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256
Connection: closeExample Domain
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
Example Domain
This domain is for use in illustrative examples in documents. You may use this
domaiResponse length: 1448
---------------------------------------------------------------Response 1:
n in literature without prior coordination or asking for permission.
Response length: 178
```