![]() |
| | #1 |
| Registered User Join Date: May 2008
Posts: 141
| winsock Code: #include <windows.h>
#include <winsock.h>
#include <string>
#include <iostream>
#pragma comment(lib, "Ws2_32.lib")
int main ()
{
int iResult;
WSADATA wsa;
WSAStartup(MAKEWORD(2,2), &wsa);
SOCKET s = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
struct sockaddr_in client;
char text[] = "12345";
client.sin_family = AF_INET;
client.sin_addr.s_addr = inet_addr("_PRIVATE_");
client.sin_port = htons( 27015 );
iResult = connect( s, (SOCKADDR*)&client, sizeof( client ) );
iResult = send( s, text, strlen( text ), NULL );
std:: cout << WSAGetLastError() << std:: endl;
}
turns out the connection was refused, need to add error checking. -_- Last edited by bobbelPoP; 07-30-2008 at 12:33 PM. |
| bobbelPoP is offline | |
| | #2 | |
| Registered User Join Date: Jan 2008
Posts: 45
| Quote:
| |
| EOP is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Winsock issues | tjpanda | Windows Programming | 3 | 12-04-2008 08:32 AM |
| Winsock Messaging Program | Morgul | Windows Programming | 13 | 04-25-2005 04:00 PM |
| Winsock - Where do i start? | Brain Cell | Networking/Device Communication | 5 | 02-14-2005 01:39 PM |
| Where do I initialize Winsock and catch messages for it? | Lithorien | Windows Programming | 10 | 12-30-2004 12:11 PM |
| winsock | pode | Networking/Device Communication | 2 | 09-26-2003 12:45 AM |