For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > WSAStartup() in _tmain() for winsock









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author WSAStartup() in _tmain() for winsock
russell.allbritain@gmail.com

2005-11-25, 7:02 pm

I am porting some functions to VC++ .net, it was written to be windows
compatible but in the original program it did its WSAS calls in main()
but when i do them in _tmain they don't seem to be workiing.

I am still getting the following type errors for the close() and
write() functions

access.c
access.c(119) : error C2692: 'close' : fully prototyped functions
required in C compiler with the '/clr' option
access.c(119) : error C2197: 'close' : too many arguments for call
through pointer-to-function
access.c(130) : error C2197: 'close' : too many arguments for call
through pointer-to-function
access.c(236) : error C2692: 'write' : fully prototyped functions
required in C compiler with the '/clr' option
access.c(236) : error C2197: 'write' : too many arguments for call
through pointer-to-function
access.c(236) : error C2197: 'write' : too many arguments for call
through pointer-to-function
access.c(236) : error C2197: 'write' : too many arguments for call
through pointer-to-function

any thoughts?

William DePalo [MVP VC++ ]

2005-11-25, 7:02 pm

<russell.allbritain@gmail.com> wrote in message
news:1132943550.134425.215090@z14g2000cwz.googlegroups.com...
>I am porting some functions to VC++ .net, it was written to be windows
> compatible but in the original program it did its WSAS calls in main()
> but when i do them in _tmain they don't seem to be workiing.


Functions whose names start with WSA. are typically asynchrous extensions to
WinSock which are intened to be used in native applications (i.e. unmanaged)
rather than .Net applications.

> I am still getting the following type errors for the close() and
> write() functions
>
> access.c
> access.c(119) : error C2692: 'close' : fully prototyped functions
> required in C compiler with the '/clr' option


Is the /clr compiler option checked? If you don't know how tell then choose
the Properties item from the Project menu. Open up the "Configuration
Properties" folder in the left pane and select the General item beneath it.
In the right pane look for "Use Managed Extensions". If Yes is selected then
that is likely to be your problem - you are inadvertently targetting the
..Net platform.

Note that I am not telling you that you can't use WinSock in a .Net
application. You can with some work but it is rarely what you want. More
often, the Socket classes would be a better choice.

To fix the problem, I'd suggest that you have the wizard start a Win32
project and then add your source files to the new project.

Regards,
Will






> access.c(119) : error C2197: 'close' : too many arguments for call
> through pointer-to-function
> access.c(130) : error C2197: 'close' : too many arguments for call
> through pointer-to-function
> access.c(236) : error C2692: 'write' : fully prototyped functions
> required in C compiler with the '/clr' option
> access.c(236) : error C2197: 'write' : too many arguments for call
> through pointer-to-function
> access.c(236) : error C2197: 'write' : too many arguments for call
> through pointer-to-function
> access.c(236) : error C2197: 'write' : too many arguments for call
> through pointer-to-function
>
> any thoughts?
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com