W5200, UDP sendto localhost
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: W5200, UDP sendto localhost
by irinakim ·
Hi~calvin2001
After socket open operate, please read the Sn_Port register.
You have to set the port number as HEX value when Socket port write in Sn_Port register.
thanks,
EK
RE: W5200, UDP sendto localhost
by calvin2001 ·
Hello EK,
thanks for your reply,I added the Sn_PORT0 polling function after socket open operation, but still get the same result, I also tried sending packet to an external listened UDP server other than sending to a localhost 127.0.0.1, it works, so I wonder if W5200 can send packet appropriately to itself, my socket function is as following:
that would be great if you can try a localhost sending procedure and show me the example, thanks a lot.
uint8 socket(SOCKET s, uint8 protocol, uint16 port, uint8 flag)
{
uint8 ret, src_port=0;
if ((protocol == Sn_MR_TCP) || (protocol == Sn_MR_UDP) || (protocol == Sn_MR_IPRAW) || (protocol == Sn_MR_MACRAW) || (protocol == Sn_MR_PPPOE))
{
close(s);
IINCHIP_WRITE(Sn_MR(s),protocol | flag);
if (port != 0) {
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((port & 0xff00) >> 8));
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(port & 0x00ff));
} else {
local_port++; // if don’t set the source port, set local_port number.
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((local_port & 0xff00) >> 8));
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(local_port & 0x00ff));
}
IINCHIP_WRITE(Sn_CR(s),Sn_CR_OPEN); // run sockinit Sn_CR
}
RE: W5200, UDP sendto localhost
by calvin2001 ·
Hello,
How is this case going?? I am still struggling with this issue…
can you simply make a try whether W5200 support connecting to itself(127.0.0.1) or not,
if it couldn’t, I could find other way to satisfy my application.
RE: W5200, UDP sendto localhost
by irinakim ·
hi,
Sorry, our server occur the problem and I don’t receive your comment.
On most computer systems, “localhost” resolves to the IP address 127.0.0.1, which is the most commonly used IPv4 loopback address.
127.0.0.1 mean internal loopback of PC and PC don’t send output data.
Therefore, IP of PC(127.0.0.1) isn’t use as communica
thanks,
Ekkim
RE: W5200, UDP sendto localhost
by calvin2001 ·
Hi ekkim,
thanks for your reply,
Yes I understand that the localhost transmission is a typical loopback purpose in most platforms,
but my application of localhost transmission was built for W5200 only,
I open a TCP/UDP socket server on W5200, for my specific purpose, I need to open one another client socket on W5200,the client socket should send one request packet to the listened socket to get some mapping data, but I failed, because the local client socket couldn’t send data to the local server, all transmission was made by W5200.
If my explanation is still not clear, please let me know.
Calvin
RE: W5200, UDP sendto localhost
by irinakim ·
Hi~
Are you use both Server ip and Client ip as 127.0.0.1?
If you connect Server(W5200) and Client(W5200) without switch hub via lan,you can send the data.
but If you connect Server and Client via switch hub, you can’t send the data.
because the ip collision occur when switch hub use.
thanks,
EK
RE: W5200, UDP sendto localhost
by calvin2001 ·
Hi EK,
About the connection of my test, the Client(W5200) and the Server(W5200) are all built in one chip, there is no any physical ethernet cable connection exist, so that it doesn’t connect to any hub, the procedures are as following:(TCP protocol)
Theoretically, these two socket should be able to transmit/receive, but they don’t. I don’t know where the problem is.