Can I run TCP Server and Client code simultaneously
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-10-31 10:47 PM
hello!
I've tested the TCP echo server and TCP echo client examples of STM32CubeMX individually and they are working fine. now I want to implement an application where I can use both application simultaneously.
So I copied the TCP echo client code files into TCP echo server's code but unfortunately my code keep getting stuck in some ethernet configuration part. are they using some kind of semaphore or something?
Solved! Go to Solution.
- Labels:
-
Ethernet
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-11-01 7:10 AM
I've completed the above task with reference of standard peripheral library "STSW-STM32060" which is much simpler the HAL libraries.
in order to merge two codes follow steps given bellow:
1)copy tcp_echoclient.c + tcp_echoclient.h file from "tcp_echo_client" and paste into the "tcp_echo_server" code folder(scr + inc).
2)open project file of "tcp_echo_server" and add "tcp_echoclient.c + tcp_echoclient.h" into "tcp_echo_server" project.
3) copy the "destination IP address" from main.h present in "tcp_echo_client" project and paste it into the main.h of "tcp_echo_server".
4)call tcp_echoclient_connect() function into main() if "EthernetLinkStatus" flag = 0. if it doesn't get connected immediately you can call tcp_echoclient_connect() after fix interval of time.
5)you can change the SOURCE IP/ GATEWAY/ SUBNET/ DESTINATION IP in main.h and port number in tcp_echoserver_init() and tcp_echoclient_connect().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-11-01 7:10 AM
I've completed the above task with reference of standard peripheral library "STSW-STM32060" which is much simpler the HAL libraries.
in order to merge two codes follow steps given bellow:
1)copy tcp_echoclient.c + tcp_echoclient.h file from "tcp_echo_client" and paste into the "tcp_echo_server" code folder(scr + inc).
2)open project file of "tcp_echo_server" and add "tcp_echoclient.c + tcp_echoclient.h" into "tcp_echo_server" project.
3) copy the "destination IP address" from main.h present in "tcp_echo_client" project and paste it into the main.h of "tcp_echo_server".
4)call tcp_echoclient_connect() function into main() if "EthernetLinkStatus" flag = 0. if it doesn't get connected immediately you can call tcp_echoclient_connect() after fix interval of time.
5)you can change the SOURCE IP/ GATEWAY/ SUBNET/ DESTINATION IP in main.h and port number in tcp_echoserver_init() and tcp_echoclient_connect().
