Advertisement

WINSOCK GODDAMNIT

Started by February 19, 2003 01:46 PM
4 comments, last by Optimus 21 years, 11 months ago
I am used to mingw32, and want to keep on using it. Is there a way to use winsock with mingw32 ? I really need this... Thx for your help, in advantage Nothing and all, by some meaning, no difference
Nothing and all, by some meaning, no difference
Dev-C++ has libraries for both WinSock 1 & 2 and uses mingw32, so try that.
Advertisement
Hmm i'm using DevC++ and trying to get just a simple Windows Winsock program to compile. I keep getting unresolved linking errors when i try to call winsock functions as shown below..

[Linker error] undefined reference to `socket@12'

everytime.. is there anything i need to add.. here is the code i'm trying to compile and i've setup a Windows Console project application.. it's driving me nuts.. any help would be apprecieated!!


    #include <windows.h>#include <winsock.h>int main(void){	SOCKADDR_IN sin;	SOCKET s;	int sin_len;	s = socket(AF_INET,SOCK_STREAM,0);	if (s == INVALID_SOCKET)	{		// Socket failed	}	sin.sin_family = AF_INET;	sin.sin_addr.s_addr = 0;	sin.sin_port = htons(100); // port=100	if (bind(s, (struct sockaddr FAR *)&sin, sizeof (sin)) == SOCKET_ERROR)	{		// Bind failed	}	if (listen(s,4)<0)	{		// Listen failed	}	 	sin_len = sizeof(sin);	s=accept(s,(struct sockaddr FAR *) & sin,(int FAR *) &sin_len);	if (s==INVALID_SOCKET)	{		// Accept failed	}	return(0);}    



[edited by - tonic151 on February 20, 2003 1:14:34 PM]
Try linking with wsock32.lib

2DNow - Yesteryears technology at your fingertips!
quote:
Original post by llyod
Try linking with wsock32.lib

2DNow - Yesteryears technology at your fingertips!



Thanks i got it working.. just having hell of a time now trying to figure out how i can get my program to interact with a connection that is already open.. any ideas how to go about this in windows.. I'm making like a addon for a telnet bbs.. when i telnet into the bbs then execute my program.. my program needs to get a handle on the Telnet socket.. but i have no idea how to go about this.. for sending text and input output back and forth... and everywhere i look i can't find any info on this.. any help would be so much apprecieated!!



[edited by - tonic151 on February 20, 2003 3:12:52 PM]
AFAIK, you can''t get access to an open socket with WinSock. You need to create the socket with socket().

Member of the Unban Mindwipe Society (UMWS)

This topic is closed to new replies.

Advertisement