Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
For those that are willing to help.
I'm attempting to write a program in C++, and I have all the elements planned, but have one problem.
The program needs to make use of Sockets. Can anyone offer some help? Direct code would be nice, though a clear tutorial would usefull as well.
(if ye choose the first, constructor taking a String host, and int port, with some appropriate method of send/receive, and closing)
Thanks

slight update
using src code found here, converted to appropriate C++ code (int main, and #include <winsock2.h>
http://msdn.microsoft.com/library/en-us/winsock/winsock/complete_client_code.asp?frame=true
I've a problem in that, when attempting to compile with MinGW (if you can specify a better free compiler, I'll take it), I get about 10 errors, undefined references to various methods.any suggestions on what might be wrong? Some how seems similar to problems I've had with namespaces before, but, can't find any references to it. Any help y'all?

Hi,
To be able to use that header file <winsock2.h> you need to import the library and put it in your work directory. The library name is WSOCK32.LIB (that is under MS VC++ 6.0). After you add that library, you should be able able to compile it without errors. To get the library, you need to look in the LIB directory in your complier folder. In MS VC++ 6.0 I found it in C:\Program Files\Microsoft Visual Studio\VC98\Lib. For MinGW, I think you should refer to manual or contact me so I send you the library by email.--
mohameda@ieee.org

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |