🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1317

Using Winsock 2.0

#1317
From: Eduardo Jauch
Date: Wed, 21 Feb 2007 15:07
37 lines
1538 bytes
Hi!

I'm trying to do some code for use winsock.

I write this:

//---------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#include <winsock2.h>

#pragma argsused

int main(int argc, char* argv[])
{
   int sockfd;

   sockfd = socket(AF_INET, SOCK_STREAM, 0);

   if (sockfd == INVALID_SOCKET)
     printf("Error: %d", WSAGetLastError());
   else
     printf("OK");

   getch();

   return 0;
}
//---------------------------------------------------------------------------


But always get sockfd with a -1 value and the ESAGetLastError with the 
value 10093.

Anyone could help me to solve this?

Thanks :)
Technical Details
Message-ID: <45dc601b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,a28f1afb8b745a2a,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 21 Feb 2007 13:07:49 -0200
From: Eduardo Jauch <eduardo.jauch@gmail.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Using Winsock 2.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 201.89.78.51
Message-ID: <45dc601b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1172070427 201.89.78.51 (21 Feb 2007 07:07:07 -0800)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail