Cadastrar
Login
Novo texto
Português
English
Português
Cadastrar
Login
Novo Texto
Importar Arquivo
This is the code that i wrote ------------------------------------------------------ #include <stdio.h> #include <winsock2.h> #pragma warning(disable : 4996) #pragma comment(lib, "Ws2_32.lib") // Winsock Library int net_init() { WSADATA wsa; SOCKET s; struct sockaddr_in server; char *message, server_reply[2000]; int recv_size; printf("1. Initialising Winsock\n"); if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) { printf("Failed. Error Code : %d", WSAGetLastError()); return 1; } printf("2. Initialised\n"); if ((s = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { printf("Could not create socket : %d", WSAGetLastError()); } printf("3. Socket created\n"); // developer.mozilla.org = 13.32.219.47 // www.goodreads.com = 52.94.237.126 server.sin_addr.s_addr = inet_addr("52.94.237.126"); server.sin_family = AF_INET; server.sin_port = htons(80); // Connect to remote server if (connect(s, (struct sockaddr *)&server, sizeof(server)) < 0) { puts("connect error"); return 1; } puts("4. Connected\n"); // Send some data message = "GET / HTTP/1.1\r\n" "Connection: close\r\n" "Cache-Control: no-cache\r\n\r\n"; if (send(s, message, strlen(message), 0) < 0) { puts("Send failed"); return 1; } puts("5. Data Send\n"); // Receive a reply from the server if ((recv_size = recv(s, server_reply, 2000, 0)) == SOCKET_ERROR) { puts("recv failed"); } puts("6. Reply received\n"); // Add a NULL terminating character to make it a proper string before printing server_reply[recv_size] = '\0'; puts(server_reply); return 0; } int main(int argc, char *argv[]) { net_init(); return 0; } ------------------------- And this is the result that i get: 1. Initialising Winsock 2. Initialised 3. Socket created 4. Connected 5. Data Send 6. Reply received HTTP/1.1 301 Moved Permanently Date: Sat, 10 Jul 2021 19:27:08 GMT Server: Server Location: https://www.goodreads.com/ Content-Length: 234 Content-Type: text/html; charset=iso-8859-1 Connection: close
Configurações do Texto
Título do Texto :
[Opcional]
Guardar na Pasta :
[Opcional]
Selecionar
Syntax Highlighting :
[Opcional]
Selecionar
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiração do Texto :
[Opcional]
Nunca
Auto Destruir
10 Minutos
1 Hora
1 Dia
1 Semana
2 Semanas
1 Mês
6 Meses
1 Ano
Status do Texto :
[Opcional]
Público
Não Listado
Privado (somente membros)
Senha :
[Opcional]
Descrição:
[Opcional]
Tags:
[Opcional]
Criptografar Texto
(
?
)
Criar Novo Texto
No momento você não está logado, isso significa que você não pode editar ou excluir nada que você poste.
Cadastre-se
ou faça o
Login
Idiomas do site
×
English
Português
Você gosta de cookies?
🍪 Usamos cookies para garantir que você obtenha a melhor experiência em nosso site.
Saber mais
Concordo