C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[56266] 오류가 나는데..고수님들의 도움이..
보기 [] 2661 읽음    2009-02-25 15:14
제가 소켓을 자바와 C로 된 소스인데 C에서 계속 "cannot open include file: 'stdafx.h': No such file or directory" 오류가 나오네요
'stdafx.h'가 없다고 나오는데 어떻게 하면 해결이 가능할까요
======================================================
    /*
    ** client.c -- a stream socket client demo
    */
#include <stdafx.h>
    #include <stdio.h>
    #include <stdlib.h>
//   #include <unistd.h>
    #include <errno.h>
    #include <string.h>
//    #include <netdb.h>
    #include <sys/types.h>
    #include <winsock2.h>
//    #include <netinet/in.h>
//    #include <sys/socket.h>

//    #define PORT 3490 // the port client will be connecting to
    #define IP   "210.115.167.37"
    #define PORT 8080

    #define MAXDATASIZE 1024 // max number of bytes we can get at once

    struct test_str
    {

        int d;
        char opr;
        char aa;
        double fl;
        double db;
    };


    int swap(int i)
    {
      int byte0 = i & 0xff;
      int byte1 = (i>>8) & 0xff;
      int byte2 = (i>>16) & 0xff;
      int byte3 = (i>>24) & 0xff;

      return (byte0<<24) | (byte1<<16) | (byte2<<8) | byte3;
    };


    int main(int argc, char *argv[])
    {
        SOCKET _socket;
        struct test_str ts;
        int numbytes;
        char buf[MAXDATASIZE];
        struct sockaddr_in their_addr; // connector's address information

        WSADATA wsa;

       if(WSAStartup(MAKEWORD(2,2), &wsa) != 0){
        fprintf (stderr, "[ERROR0] : <<  \n");
        exit(1);
       }


        if ((_socket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET ) {
            fprintf (stderr, "[%d] Socket_Create() \n", WSAGetLastError());
            exit(1);
        }

        their_addr.sin_family = AF_INET;    // host byte order
        their_addr.sin_port = htons(8000);  // short, network byte order
        their_addr.sin_addr.s_addr = inet_addr("210.115.167.37"); //*((struct in_addr *)he->h_addr);
        memset(&(their_addr.sin_zero), '\0', 8);  // zero the rest of the struct

        if (connect(_socket, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) {
            fprintf (stderr, " Socket_Connect() Error : [%d]\n", WSAGetLastError());
            exit(1);
        }

        ts.d   = 0;
        ts.opr = 'z';
        ts.aa  = 'K';
        ts.fl  = 2.35;
        ts.db  = 19.445634;

        //보내기
        if (send(_socket, (const char *)&ts, sizeof(ts), 0) == SOCKET_ERROR){
            fprintf (stderr, " Socket_Send() Error : [%d]\n", WSAGetLastError());
            exit(1);
        }

        //받기
        if ((numbytes=recv(_socket, buf, MAXDATASIZE-1, 0)) == SOCKET_ERROR) {
            fprintf (stderr, " Socket_Recv() Error : [%d]\n", WSAGetLastError());
            exit(1);
        }

        printf("Received: [%s]",buf);

        closesocket(_socket);

        return 0;
    }
===========================================

+ -

관련 글 리스트
56266 오류가 나는데..고수님들의 도움이.. 보기 2661 2009/02/25
56282     Re:오류가 나는데..고수님들의 도움이.. 전재득 2229 2009/02/26
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.