Socket 통신의 수신부에 들어오는 정보량에 대해 질문있습니다.

익명 사용자의 이미지

Socket 통신에서 Buffer를 사용하여 파일을 보내고 있습니다.

setsockopt를 사용하여 소켓의 버퍼의 크기를 늘려 통신을 진행하고 있습니다.

그런데 송신부에서는 지정한 buffer의 크기만큼 data가 잘려서 넘어가는데

수신부에서는 buffer의 크기가 충분히 큼에도 불구하고 1448의 배수만큼 정보를 받는 상태입니다.
(Buffer의 크기와 비교해 보면 매우 작은 값입니다.)

이 경우에 buffer의 크기만큼 수신부도 정보를 받을 수 있는 방법이 있을까요??

pynoos의 이미지

Yi Soo An@Google의 이미지

도움이 되실까해서 책에서 발췌한 내용을 첨부드립니다. pynoos님이 첨부해주신 링크와 같이 보시면 될 것 같습니다.

The client in this example announces an MSS of 536 (indicating that it implements
only the minimum reassembly buffer size) and the server announces an MSS of 1,460
(typical for IPv4 on an Ethernet). It is okay for the MSS to be different in each
direction (see Exercise 2.5).
Once a connection is established, the client forms a request and sends it to the server.
We assume this request fits into a single TCP segment (i.e., less than 1,460 bytes
given the server's announced MSS). The server processes the request and sends a
reply, and we assume that the reply fits in a single segment (less than 536 in this
example). We show both data segments as bolder arrows.

댓글 첨부 파일: 
첨부파일 크기
Image icon packet_exchange.jpg29.31 KB

---------------
Happy Hacking!

라스코니의 이미지

송신부 ----------- 수신부 사이에는 데이터를 옮겨주는 TCP 계층이 있습니다.
송신부 --- TCP --- 수신부 이렇게 됩니다.

송신부에서 아무리 버퍼를 크게 잡아도 TCP는 일정한 크기로 잘라서 보냅니다. 그 크기가 커지면 물론 한번에 보낼 수 있는 단위가 커지기 때문에 효율적일 것 같지만 동시에 오류 발생시 버려지는 데이터도 커지는 것입니다. 그래서 짤라서 보내는 크기는 일정하게 되어 있습니다. 그러니 예를들어 1 Mbyte 단위로 보내는 것은 가능하지 않습니다. 성공적으로 데이터를 받는다는 것은 데이터를 받는 쪽에서 받은 데이터를 얼마나 잘 합치느냐지 버퍼 사이즈를 크게 잡는 것에 크게 영향을 받지 않습니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.