參數(shù)資料
型號(hào): MCW1001AT-I/SS
廠商: Microchip Technology
文件頁數(shù): 16/66頁
文件大?。?/td> 0K
描述: IC INTERFACE SOCKET XLP 28-SSOP
標(biāo)準(zhǔn)包裝: 2,100
系列: *
2011 Microchip Technology Inc.
Preliminary
DS70671A-page 23
MCW1001A
5.0
TRANSMITTING AND
RECEIVING PACKETS
5.1
TCP
TCP is a standard transport layer protocol described in
Request for Comments (RFC) 793. It provides reliable
stream-based connections over unreliable networks,
and forms the foundation for HTTP, SMTP, and many
other protocol standards. Connections made over TCP
guarantee data transfer at the expense of throughput.
Connections are made through a three-way handshake
process, ensuring a one-to-one connection. Remote
nodes advertise how much data they are ready to
receive,
and
all
data
transmitted
must
be
acknowledged. If a remote node fails to acknowledge
the receipt of data, it is automatically retransmitted.
This ensures that network errors such as lost,
corrupted, or out-of-order packets are automatically
corrected. To accomplish this, TCP must operate in a
buffer. Once the transmit buffer is full, no more data can
be sent until the remote node has acknowledged
receipt. Likewise, the remote node cannot transmit
more data until the local device has acknowledged
receipt and that space is available in the buffer. The
following example illustrates how to use TCP packets:
EXAMPLE 5-1:
USING TCP PACKETS
The MCW1001A TCP sockets can be configured as
servers or clients. The procedure for transferring TCP
packet data in each configuration differs slightly.
5.1.1
MCW1001A TCP SERVER
EXAMPLE
:
1.
Create a TCP socket with call to socket(). This
will return an 8-bit socket handle to be used
when later referencing this socket.
2.
Bind the socket to the listen port with call to
bind(). The bind API specifies the 16-bit local
port number that the client will attempt a
connection on.
3.
Prepare the socket to listen for a connection with
call to listen(). The listen process opens the
specified number of listening sockets that
become the children sockets of the bound
parent. They will all listen to the port specified in
the bind process, but they may accept
connections from different clients (different IP
addresses, different remote port numbers). If the
number of sockets specified is not available, the
listen process will return the number of sockets
it was not able to allocate.
4.
Accept incoming connection through a call to
accept(). Accept is non-blocking for the
MCW1001A and accepting a connection from a
client must be done through polling the socket
with the Accept API.
5.
Communicate with the remote host using send()
and recv().
6.
Close the socket with call to close().
5.1.2
MCW1001A TCP CLIENT EXAMPLE
:
1.
Create a TCP socket with call to socket().
2.
Optionally apply a local port number with a call
to bind(). Otherwise, a pseudo-random local port
number will be assigned.
3.
Connect to the server with call to connect(),
passing sockaddr, IP address.
4.
Communicate with the remote host using send()
and recv().
5.
Close the socket with call to close().
相關(guān)PDF資料
PDF描述
MCZ145010EG IC SMOKE DETECT PHOTOELEC 16SOIC
MCZ145012EG IC SMOKE DETECT PHOTOELEC 16SOIC
MCZ33094EG IC IGNITION CONTROL 12V 16-SOIC
MCZ33287EG IC DRIVER DUAL LOSIDE MON 20SOIC
MCZ33290EF IC SER LNK INTER ISO KLINE 8SOIC
相關(guān)代理商/技術(shù)參數(shù)
參數(shù)描述
MCW1011 制造商:MINMAX 制造商全稱:Minmax Technology Co., Ltd. 功能描述:2W, Wide Input Range SIP, Single Output DC/DC Converters
MCW1012 制造商:MINMAX 制造商全稱:Minmax Technology Co., Ltd. 功能描述:2W, Wide Input Range SIP, Single Output DC/DC Converters
MCW1013 制造商:MINMAX 制造商全稱:Minmax Technology Co., Ltd. 功能描述:2W, Wide Input Range SIP, Single Output DC/DC Converters
MCW1021 制造商:MINMAX 制造商全稱:Minmax Technology Co., Ltd. 功能描述:2W, Wide Input Range SIP, Single Output DC/DC Converters
MCW1022 制造商:MINMAX 制造商全稱:Minmax Technology Co., Ltd. 功能描述:2W, Wide Input Range SIP, Single Output DC/DC Converters