Hot!control the PIC32 eth kits client (leds turn on/off) from server socket.

Author
mohammad faizan
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2017/10/24 04:53:06
  • Location: 0
  • Status: offline
2017/12/29 03:57:41 (permalink)
0

control the PIC32 eth kits client (leds turn on/off) from server socket.

Hi,
I have a working code of tcpip tcp client, which is capable of sending a data (text) from PIC32 eth kit to server.
Here PIC32 as a client and Server socket as a server. I had define a IP and port in app.c,
case APP_TCPIP_WAITING_FOR_COMMAND:
{
IPV4_ADDR addr;
appData.host = "192.168.1.102";
TCPIP_Helper_StringToIPAddress(appData.host,&addr);
appData.socket = TCPIP_TCP_ClientOpen(IP_ADDRESS_TYPE_IPV4,2000,(IP_MULTI_ADDRESS*)&addr);
  .......................
after that I had define a text message  in
case APP_TCPIP_WAIT_FOR_CONNECTION:
{
char buffer[250] = "Welcome to the world of innovation where we enable the technologies....."
On server socket I received a message,
server PC@ 192.1468.1.102  is running on port 2000,
connection is established
Welcome to the world of innovation where we enable the technologies
Here I received the text. 
PIC32 eth kit is working as a client which is sending a text, I want to use the client for receiving a text from server socket, first, it will send a text and after that it will receive a text from server socket which will turn the leds ON/OFF.
I need your help, 
As data is send to server socket, a connection is already established, I want to know that, can I define the port and IP again,
I had define the following cases for tcpip tcp client// sending
case APP_TCPIP_WAIT_FOR_IP:
case APP_TCPIP_WAITING_FOR_COMMAND: (define the ip and port)
case APP_TCPIP_WAIT_ON_DNS:
case APP_TCPIP_WAIT_FOR_CONNECTION: (TEXT MESSAGE)
case APP_TCPIP_WAIT_FOR_RESPONSE:
I had define the following cases for tcpip tcp client// receiving
I want to know that can I continue in the same switch(appData.state) or I have to define the another switch,
case APP_TCPIP_OPENING_CLIENT:
case APP_TCPIP_WAIT_FOR_CONNECTION:
case APP_TCPIP_WAIT_FOR_RESPONSE:
case APP_TCPIP_CLOSING_CONNECTION:
char App_Message_Buffer[MAX_URL_SIZE] = "START";
char App_Message_Buffer[MAX_URL_SIZE] = "STOP";
{
i = AppBuffer[];
if(strcmp(i,"START")==0)
{
PLIB_PORTS_PinSet( PORTS_ID_0, PORT_CHANNEL_D, led);
}
elseif(strcmp(i,"STOP")==0)
{
 PLIB_PORTS_PinClear( PORTS_ID_0, PORT_CHANNEL_D, led);
}
I want to use this function which will compare the received text and make the leds on/off. I need your help, please help me to implement this
 
#1

1 Reply Related Threads

    mohammad faizan
    New Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2017/10/24 04:53:06
    • Location: 0
    • Status: offline
    Re: control the PIC32 eth kits client (leds turn on/off) from server socket. 2018/02/10 01:57:46 (permalink)
    0
    Solved
    #2
    Jump to:
    © 2018 APG vNext Trial Version 4.5