Private Sub Class_Initialize()
Dim wsaData As WSA_Data
If (WSAStartup(WINSOCK_VERSION, wsaData)) Then
MsgBox "Can't init"
Exit Sub
End If
'-----------Create-Socket---------------------
Dim s As Integer
s = socket(PF_INET, SOCK_STREAM, 0)
If (s = INVALID_SOCKET) Then
MsgBox "Error create socket"
Exit Sub
End If
'--------------Bind
Dim socketaddr As sockaddr
Dim Port As Integer
Port = 80
'socketaddr = saZero
socketaddr.sin_family = AF_INET
socketaddr.sin_addr = inet_addr("195.161.119.91")
socketaddr.sin_port = htons(Port)
'socketaddr.sin_zero = String(8, vbNullChar)
'Dim c
If (connect(s, socketaddr, Len(socketaddr)) = SOCKET_ERROR) Then
MsgBox "Bad bind"
Debug.Print WSAGetLastError()
Exit Sub
Else
MsgBox "Good bind"
End If
'End If
Dim buf As Variant, r As Variant
buf = "" & _
"POST / HTTP/1.0" & vbCrLf & _
"Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
"Content-Length: 30" & vbCrLf & _
"Host: chat.chat.ru" & vbCrLf & _
"Accept: text/html, */*" & vbCrLf & _
"User-Agent: MSIE 6.0 (compatible; bot)" & vbCrLf & _
" & vbCrLf " & _
"username=tarrac&passwd=wqe"
' r = recv(s, buf, 1, 0)
Dim str As String
r = send(s, buf, Len(buf), 0)
r = recv(s, str, 20, 0)
End Sub
Сейчас этот форум просматривают: Google-бот, SemrushBot, Yandex-бот и гости: 36