데이타 전송이 잘안되고 있습니다.

익명 사용자의 이미지

typedef struct {
int iSignature1;
char szContentsId[12];
char szChargNumber[12];
char szResv[12];
int uiLen;
char achSignature2[4];
} MacsHeaderPkt;

typedef struct {
MacsHeaderPkt stHeader;
char achData[1];
} MacsSvcPkt;

get_filename(BREW_SVC_PACKET *recvPacket,int client_fd)
{
char strBuffer2[2048];

MacsSvcPkt *pstPacket = (MacsSvcPkt *)strBuffer2;
memset(strBuffer2, 0, sizeof(strBuffer2));

fp=open(filename,O_RDONLY);

read(fp,pstPacket->achData, file_size);
if(read==0){
printf("error read (fp,pstPacket->achData)\n");
}
printf("achData %s\n",pstPacket->achData);
printf("achData size %d\n",strlen(pstPacket->achData));
데이타 내용과 사이즈가 확인이 됩니다. txt파일인경우만 되구
다른 파일인경우는 안되더라구요.

charsWrite=write(client_fd,strBuffer2,file_size+48);
if(charsWrite !=(file_size+48)) fatalError();
printf("data %s\n",pstPacket->achData);
printf("datasize %d\n",stleng(pstPacket->achData));
데이타 내용과 사이즈가 아무것도 안들어 가네요
}

헤더와 파일을 보내는데요, struct 형태로 보내는데요,
헤더 부분은 잘가는데, achData 부분을 확인하면 내용이 없습니다.

클라이언트가 제대로 데이타를 받지 않고 있습니다.ㅜㅡ
어느 부분에 이상이 있는 것인지요.

익명 사용자의 이미지

PACKED관련 부분

익명 사용자의 이미지

클라이언트와 서버간에 text string은 전달되는 데,
binary value가 제대로 전달되지 않는 다면,

1. byte order가 일치하지 않는 문제
2. 32비트와 64비트 시스템에 따라 long int 타입의 데이터를 다르게 저장
하는 문제,
3. 머신간에 상이한 alignment restriction으로 인해 구조체(padding 문제
가 발생함으로써 야기되는)의 크기가 다르게 취급되는 문제

를 검토해봐야 합니다 .

관련 내용과 해결책은 stevens님의 unix network programming volum 1 중
137-140쪽 을 참고하시기 바랍니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.