Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Socket programming with c.

Status
Not open for further replies.

mattias1975

Programmer
Jul 26, 2004
36
SE
I have made a small program:

#include <winsock2.h>
#include <wininet.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>

void main(){
int sock = socket (PF_INET, SOCK_RAW, IPPROTO_TCP);
cout << sock;
}

But the socket function returns the value -1 which i knowis a error code. I think it should return 1 if it is ok.
Why does not this work? Why do i get the error code -1.
 
forum116 is the Microsoft: Visual C++ Forum - they're better equipeed to answer this sort of question!


<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top