Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 19:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Winsock error with gethostbyname

Discussion on Winsock error with gethostbyname within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2013
Posts: 7
Received Thanks: 0
Unhappy Winsock error with gethostbyname

Hello, I started Winsock science, and applied the first obstacle in learning this error:

Quote:
error C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings.
and here the code:

Quote:
if((host=gethostbyname("localhost"))==NULL)
{
std::cout << "Nie mozna rozpoznac nazwy hosta\r\n";
WSACleanup();
system("PAUSE");
return 0;
}
Apparently the problem should take after changing gethostbyname to getaddrinfo () or GetAddrInfoW ()
but then appears next error

Quote:
For getaddrinfo
if ((host=getaddrinfo("localhost")) == NULL)
error C3861: 'getaddrinfo': identifier not found
IntelliSense: identifier "getaddrinfo" is undefined


For GetAddrIndoW
if ((host=GetAddrInfoW("localhost")) == NULL)
error C3861: 'GetAddrInfoW': identifier not found
IntelliSense: identifier "GetAddrInfoW" is undefined
How to fix these errors?

Library that I use:
Quote:
#include "stdafx.h"
#include <iostream>
#include <WinSock2.h>
#pragma comment(lib,"ws2_32.lib")
haperzik12345 is offline  
Reply


Similar Threads Similar Threads
Winsock Hook
03/31/2015 - C/C++ - 3 Replies
Hey Leute, ich wollte mich mal dran wagen selber versuchen die Winsock "connect" funktion zu hooken, und nunja es hat geklappt. Aber natürlich ist es damit nicht getan weil mich nach Ca 30 Sekunden XTRAP rauswirft. (Also meine Hook funktioniert Perfekt, MS - Detours wurde benutzt.) Nun hab ich glaub ich schon 2 Stunden lang etliche Tutorials angeguckt und hab dann versucht es per "Mid Function Hooking" zu lösen, ich hab zwar irgendwas falsch gemacht, und der Client crashte aber dennoch hat...
[Advanced] Winsock in C#
05/23/2013 - CO2 Programming - 7 Replies
Requires ws2_32.dll, and "using System.Runtime.InteropServices" // fuck creating my own socketerror enum LOL using SocketError = System.Net.Sockets.SocketError; // Interface to ws2_32.dll public unsafe partial class Native
[TUT]Winsock & VB.NET
11/21/2011 - Coding Tutorials - 0 Replies
Ich hab eben mal die sufu benutzt und bemerkt das viele Leute noch probleme mit winsock haben seti vb.NET da dies eigentlic hdafür abgeschafft wurde. So geht es aber tortzdem (1 CLIENT NUR!) Als erstes machen wir eine Winsock oberfläche auf die neue Form, wer kein winsock komponente hat macht dies mswinsock.ocx downloaden 32 BIT -> kopiert die mswinsock.ocx nach C:/Windows/System32/ dann cmd als ADMIN AUSFÜHREN! und regsvr32 mswinsck.ocx, oder wie ihr sie genannt habt eingeben. VS,...
Winsock Error
08/17/2011 - Flyff Private Server - 4 Replies
Hey, ich möchte mal fragen ob jemand mir mit dem Problem mit Infiltration helfen kann. Ich habe das Problem dass wenn ich auf Brutforce CRC Key klicke, und er angeblich auch einen gefunden hat klicke ich auf Create Item. Warte... und bekomme eine Fehler meldung undzwar: Winsock error: 10038 *Bild ist unten* Ausserdem bewegen sich die Monster nicht mehr. Den FAQ habe ich auch gelesen, andere habe das selbe Problem wurden aber nicht geklärt. Danke für die hilfe im Vorraus. Ausserdem...
winsock in vb.net?
12/29/2007 - Conquer Online 2 - 4 Replies
anyone know how to get winsock into vb.net?ive been googleing for an answer and cant findone. i downloaded oswinsock and still not sure how to use it?? Ive been using vb6 for a while and am using vb 2005 for the first time and this is pissing me off.i read i should use systemcom.net or somthing? just anyone know how i can use winsock in vb.net or explain what i need to do,before i give up on this .net framework and stick with my trusty vb6 if anyone has a simple source proxy in...



All times are GMT +2. The time now is 19:02.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.