user-0 提问: 打印wireshark抓包软件数据

回复:
user: user-1
content: 引用 23 楼 zfh19921230 的回复:大神,socket接收到的unsigned char 数组,怎么能再把这个数据同样的发送给客户端 send The Windows Sockets send function sends data on a connected socket.  int send (   SOCKET s,                 const char FAR * buf,     int len,                  int flags               );   Parameters s  [in] A descriptor identifying a connected socket.  buf  [in] A buffer containing the data to be transmitted.  len  [in] The length of the data in buf.  flags  [in] An indicator specifying the way in which the call is made.  Remarks The send function is used to write outgoing data on a connected socket. For message-oriented sockets, care must be taken not to exceed the maximum packet size of the underlying provider, which can be obtained by using getsockopt to retrieve the value of socket option SO_MAX_MSG_SIZE. If the data is too long to pass atomically through the underlying protocol, the error WSAEMSGSIZE is returned, and no data is transmitted.   The successful completion of a send does not indicate that the data was successfully delivered.  If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode. On nonblocking stream oriented sockets, the number of bytes written can be between 1 and the requested length, depending on buffer availability on both client and server machines. The select, WSAAsyncSelect or WSAEventSelect functions can be used to determine when it is possible to send more data.  Calling send with a zero len parameter is permissible and will be treated by implementations as successful. In such cases, send will return zero as a valid value. For message-oriented sockets, a zero-length transport datagram is sent.  The flags parameter can be used to influence the behavior of the function beyond the options specified for the associated socket. The semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by or-ing the following values:  Value Meaning  MSG_DONTROUTE Specifies that the data should not be subject to routing. A Windows Sockets service provider can choose to ignore this flag.  MSG_OOB Send out-of-band data (stream-style socket such as SOCK_STREAM only. Also see DECnet Out-Of-band data for a discussion of this topic).    Windows CE: For IrSockets implementation, the Af_irda.h file must be explicitly included.  Return Values If no error occurs, send returns the total number of bytes sent, which can be less than the number indicated by len for nonblocking sockets. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.  Error Codes WSANOTINITIALISED A successful WSAStartup must occur before using this function.  WSAENETDOWN The network subsystem has failed.  WSAEACCES The requested address is a broadcast address, but the appropriate flag was not set. Call setsockopt with the SO_BROADCAST parameter to allow the use of the broadcast address.  WSAEINTR A blocking Windows Sockets 1.1 call was canceled through WSACancelBlockingCall.  WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.  WSAEFAULT The buf parameter is not completely contained in a valid part of the user address space.  WSAENETRESET The connection has been broken due to the "keep-alive" activity detecting a failure while the operation was in progress.  WSAENOBUFS No buffer space is available.  WSAENOTCONN The socket is not connected.  WSAENOTSOCK The descriptor is not a socket.  WSAEOPNOTSUPP MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, out-of-band data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only receive operations.  WSAESHUTDOWN The socket has been shut down; it is not possible to send on a socket after shutdown has been invoked with how set to SD_SEND or SD_BOTH.  WSAEWOULDBLOCK The socket is marked as nonblocking and the requested operation would block.  WSAEMSGSIZE The socket is message oriented, and the message is larger than the maximum supported by the underlying transport.  WSAEHOSTUNREACH The remote host cannot be reached from this host at this time.  WSAEINVAL The socket has not been bound with bind, or an unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled.  WSAECONNABORTED The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.  WSAECONNRESET The virtual circuit was reset by the remote side executing a "hard" or "abortive" close. For UPD sockets, the remote host was unable to deliver a previously sent UDP datagram and responded with a "Port Unreachable" ICMP packet. The application should close the socket as it is no longer usable.  WSAETIMEDOUT The connection has been dropped, because of a network failure or because the system on the other end went down without notice.    QuickInfo   Windows NT: Yes   Windows: Yes   Windows CE: Use version 1.0 and later.   Header: Declared in winsock2.h.   Import Library: Link with ws2_32.lib.  See Also recv, recvfrom, select, sendto, socket, WSAAsyncSelect, WSAEventSelect

user: user-1
content: 引用 26 楼 zfh19921230 的回复:现在遇到最后一个问题了,就是怎么将pcm数据转成mp3数据,不通过pcm数据转为pcm文件操作 使用bass库或者NCTAudioStudio控件。

user: user-0
content: 现在遇到最后一个问题了,就是怎么将pcm数据转成mp3数据,不通过pcm数据转为pcm文件操作

user: user-0
content: 嗯呢,这个我知道了,现在我想问怎么能一边写文件,一边从这个文件里读出来

user: user-1
content: 百度搜相关关键字。

user: user-0
content: 大神,知道ffmpeg怎么将实时说话的音频字节流转为.flv的格式的吗

user: user-0
content: 大神,socket接收到的unsigned char 数组,怎么能再把这个数据同样的发送给客户端

user: user-1
content: 没约定就约定啊。

user: user-1
content: http://blog.csdn.net/belllab/article/details/3887089

user: user-1
content: 引用 18 楼 zfh19921230 的回复:大神,知道怎么将字节流编码成pcm格式的文件吗 参考15楼。

user: user-0
content: 大神,知道怎么将字节流编码成pcm格式的文件吗

user: user-0
content: 发送方的就是字节流

user: user-0
content: 我用那个方法保存到文件,然后文件里都是0000,我把sprintf(binstr,"%s %02x",binstr,(unsigned char)buf[i]);改成sprintf(binstr,"%s %04x",binstr,(unsigned char)buf[i])打印出了一点儿数据

user: user-1
content: 如果数据本来对应发送方发送的某个文件比如mp3文件，将文件的扩展名由bin改为mp3

user: user-1
content: 引用 5 楼 zfh19921230 的回复:void HexDump(char *buf,int len,int addr)我只想要里面的数据段,不要前后的描述的东西,怎么搞啊 参考1楼。

user: user-0
content: 对方发的就是8进制的字节流,格式好像没有约定,接收到的都是8进制的数据

user: user-1
content: 了解一下“bass库”

user: user-1
content: 64-bit doubles (RAW) (*.dbl) 8-bit signed (*.sam) A/mu-Law Wave (*.wav) ACM Waveform (*.wav) Amiga IFF-8SVX (*.iff;*.svx) Apple AIFF (*.aif;*.snd) ASCII Text Data (*.txt) CD Digital Audio (*.cda) Cool Edit Loop (*.cel) Creative Sound Blaster (*.voc) Dialogic ADPCM (*.vox) DiamondWare Digitized (*.dwd) DVI/IMA ADPCM (*.wav) ……

user: user-1
content: 引用 11 楼 zfh19921230 的回复:现在可以用8进制的形式打印出发送的流的数据,怎么把它转化成能播放的MP3或者wav等音频播放的文件格式 这完全决定于发送方和接收方对传输的字节流的格式约定。 比如： DATA_FORMAT_DIALOGIC_ADPCM	 DATA_FORMAT_ALAW			 DATA_FORMAT_G726			 DATA_FORMAT_MULAW			 DATA_FORMAT_PCM				 DATA_FORMAT_G711_ALAW		 DATA_FORMAT_G711_MULAW		 DATA_FORMAT_G721			 DATA_FORMAT_DIALOGIC_ADPCM_U ……

user: user-0
content: 求助大神了啊