I could really use an example of a TCP/IP socket listner on ethernet or wifi. I am using a mikromedia 7 STM32f7 board.
All examples are using Webserver examples and the ethernet doesn't have any listner function?
Thanks, Wim
TCP/IP Listner socket ARM STM32F7 Ethernet and/or WiFI
-
- Posts: 3
- Joined: 23 Aug 2017 16:26
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: TCP/IP Listner socket ARM STM32F7 Ethernet and/or WiFI
Hello,
Have you checked the provided example in the examples folder of the ARM compiler ? It does open a web page, but the web page is hosted on the MCU. The example waits (listens) to a correct address on port 80 to be received and it then sends the packets which translate to that page being displayed. You can use that example as a reference, or you can see the library's HELP (right click on the Ethernet library and "Help")
Best regards
Have you checked the provided example in the examples folder of the ARM compiler ? It does open a web page, but the web page is hosted on the MCU. The example waits (listens) to a correct address on port 80 to be received and it then sends the packets which translate to that page being displayed. You can use that example as a reference, or you can see the library's HELP (right click on the Ethernet library and "Help")
Best regards
BR,
Darko
Darko
-
- Posts: 3
- Joined: 23 Aug 2017 16:26
Re: TCP/IP Listner socket ARM STM32F7 Ethernet and/or WiFI
The example is only about a web server,
the commands:
char Net_Wireless_SPWF01S_SocketServer(unsigned int port, unsigned char *pktType);
this seems to open a socket listner, i can connect from my PC, stil i can read from it because whats the sockID?
see the read command:
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
if i use the other way connecting to my PC, it works very un stable,i addid this in the example at the place start server.:
char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_SendToSocket(unsigned char sockID, unsigned char *msg, unsigned int msgLen);
Reading totally doesnt't work while using this create socket :
char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
the commands:
char Net_Wireless_SPWF01S_SocketServer(unsigned int port, unsigned char *pktType);
this seems to open a socket listner, i can connect from my PC, stil i can read from it because whats the sockID?
see the read command:
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
if i use the other way connecting to my PC, it works very un stable,i addid this in the example at the place start server.:
char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_SendToSocket(unsigned char sockID, unsigned char *msg, unsigned int msgLen);
Reading totally doesnt't work while using this create socket :
char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
-
- Posts: 3
- Joined: 23 Aug 2017 16:26
Re: TCP/IP Listner socket ARM STM32F7 Ethernet and/or WiFI
The answer is about the webserver, this is not wat i need, i need a
simple TCP/IP socket, ideal a socketserver.
- create socket server
is missing the sockID, how to read from that socket?
If i use
the create socket, it works very bad, somethimes i get someting send to my
PC, after a while it stops.
This is my test code in the adopted wifi
example function start server (wifi demo
media7):
Net_Wireless_SPWF01S_GetCurrentIP(ipAddr);
ipAddr[3]=15;
strcat( (ipText+4), ip2Str(ipAddr, ipStr) );
UpdateDescription(&ipLabel, ipText);
Net_Wireless_SPWF01S_CreateSocket(ipAddr,
"_NET_WIRELESS_SPWF01S_ADDRESS_IP", 1234,
"_NET_WIRELESS_SPWF01S_PACKET_TCP", 0, sockID);
while(1){
Net_Wireless_SPWF01S_SendToSocket(sockID, "Hallo", 5);
Delay_ms(500);
}
These functions i need to have working in a simple example:
char Net_Wireless_SPWF01S_SocketServer(unsigned int port, unsigned char *pktType);
Optional: char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
char Net_Wireless_SPWF01S_SendToSocket(unsigned char sockID, unsigned char *msg, unsigned int msgLen);
Thanks
simple TCP/IP socket, ideal a socketserver.
- create socket server
is missing the sockID, how to read from that socket?
If i use
the create socket, it works very bad, somethimes i get someting send to my
PC, after a while it stops.
This is my test code in the adopted wifi
example function start server (wifi demo
media7):
Net_Wireless_SPWF01S_GetCurrentIP(ipAddr);
ipAddr[3]=15;
strcat( (ipText+4), ip2Str(ipAddr, ipStr) );
UpdateDescription(&ipLabel, ipText);
Net_Wireless_SPWF01S_CreateSocket(ipAddr,
"_NET_WIRELESS_SPWF01S_ADDRESS_IP", 1234,
"_NET_WIRELESS_SPWF01S_PACKET_TCP", 0, sockID);
while(1){
Net_Wireless_SPWF01S_SendToSocket(sockID, "Hallo", 5);
Delay_ms(500);
}
These functions i need to have working in a simple example:
char Net_Wireless_SPWF01S_SocketServer(unsigned int port, unsigned char *pktType);
Optional: char Net_Wireless_SPWF01S_CreateSocket(uint8_t* address, uint8_t isIP, uint16_t port, uint8_t* pktType, TBool ind, uint8_t* sockID);
char Net_Wireless_SPWF01S_ReadSocket(unsigned char sockID, unsigned int msgLen, unsigned char *rdBuff);
char Net_Wireless_SPWF01S_SendToSocket(unsigned char sockID, unsigned char *msg, unsigned int msgLen);
Thanks