wav파일이나 mp3 파일 파일은 그냥 전송하면 안되나요?

kknd345의 이미지

서버/ 클라이언트 wav파일 전송 프로그램 만들고 있는데요

클라이언트에서 바이너리 모드로 서버에서 패킷을 받아서
저장을 했는데요.

파일의 용량은 같은데 음악을 틀면 엄청나게 이상하게 바껴버리네요.

왜 그런건가요?

바이너리 파일이면 어짜피 2진 코드인데 다 받으면 똑같야 되는거 아닌가요?

가르쳐 주세요 ( 그냥 전송해도 되는건가요?)

Prentice의 이미지

혹시 서버와 클라이언트의 endianness가 서로 다른가요? Wav 파일의 경우 샘플 크기가 16bit 이상이고요.

참고로 RIFF 헤더가 붙은 wav 파일의 경우 무조건 little-endian인 것으로 알고 있습니다. (아닐 수도 있습니다.)

kknd345의 이미지

서버는 리눅스이고요 클라이언트는 윈도우입니다.

TCP를 이용하여
리눅스에서 파일포인터를 이용해 wav파일을 읽어
300BYTE씩 날리고 윈도우에서 recv 를 이용하여 받아서
fwrite를 이용하여 파일 저장을 했습니다.

인텔과 AMD 라서 endian 의 차이는 없을거라고 생각되는데...

좀 도와주세요.( 용량은 분명히 리눅스 파일이랑 윈도우 파일이랑 같은데.. 안되네요 ㅜㅜ)

1%의 가능성이면 충분하다!
최선을 다하자!

Prentice의 이미지

전송 전과 후의 파일이 동일한지, 다르면 어떻게 다른지 먼저 확인하셔야 할 것 같네요..

kknd345의 이미지

아 잘 됩니다 ㅜㅜ.. 혼자 삽질 했네요.

파일 받을때 종류 구분한다고 구조체로 받은걸 깜박했네요 ㅜㅜ.
구조체의 앞부분 때내고 파일 저장할때 모르고 구조체 그대로 해버렸네요.

그래도 답변 달아 주신거 감사합니다 ^^~

1%의 가능성이면 충분하다!
최선을 다하자!

Necromancer의 이미지

16진 덤프 뜨는 프로그램 짜서 돌려서 비교하면 금방 알죠.

옛날 도스의 DEBUG처럼

Written By the Black Knight of Destruction

litdream의 이미지

hexdump -C 16진 덤프 보는프로그램 입니다.

삽질의 대마왕...

댓글 달기

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