TCP library Auto connection support needed

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
nikhilvv07
Posts: 38
Joined: 08 Sep 2016 14:17

TCP library Auto connection support needed

#1 Post by nikhilvv07 » 21 Jan 2020 15:02

hi,

Am trying library example HTTP DEMO code of ENC24J600 network Library for different controller.

MCU : Dspic33FJ128GP306 i/p
Library : Network_Ethernet_dsPIC (Net_Ethernet_24J600)

In my recent project i was replying to the TCP request which receive from TCP client which is successfully tested.

And now i need to config the controller as a client which send continues response/reply to the server or other interface soft/ module without receiving any request from other end.

am using predefined remote_IP , Port and other network settings.

i was trying using Net_Ethernet_24j600_connectTCP(sysIpAddr, System_Port, My_Port, &sock1); and Net_Ethernet_24j600_startSendTCP(sock1); functions.

But the problem is i have to start initiate request from otherend or PC so that it gettinh start communicate with remote host.

how to start connect and communicate without any request from remote host?


This is the USEr TCP () :

void Net_Ethernet_24j600_UserTCP(SOCKET_24j600_Dsc *socket) {

Uint Reply_Length = 0,Max_request_Len = 7;
Uchar i =0;

// I listen only to web request on port 502 (TCP PORT )
if(socket->destPort != My_Port) {
return;
}

Reply_Length = _REPLY_STRING_LEN;
Net_Ethernet_24j600_putBytesTCP(ETH_Reply_Buf, Reply_Length, socket); //Send temp buffer

/* if( Net_Ethernet_24j600_bufferEmptyTCP(socket)&&(ETH_Reply_Buf >= 2000) ) {
Net_Ethernet_24j600_disconnectTCP(socket);
} */
}


_nikhil

nikhilvv07
Posts: 38
Joined: 08 Sep 2016 14:17

Re: TCP library Auto connection support needed

#2 Post by nikhilvv07 » 28 Jan 2020 07:27

Hi,

Am looking a Ethernet based monitoring system which monitor digital inputs and send those input status to pre-configured system.

Host system will continues listen controller system and does not provide any requests to controller for data packets.

I am able to manage to reply to the host request but not getting any data pack from controller without request.

While going through some posts there it suggested to wait to establish connection and start sending packets after connecting to system.

i Tried in similar way but not getting any response from controller.

If any one have an idea to do it will be great.

am attaching my code here inwhich i am trying to send continues packets to system.
To monitor packets am using TCP Client server software from NSAUDITOR.com. (configuring as server).
Attachments
TCP Client_demo.rar
(157.16 KiB) Downloaded 103 times

Post Reply

Return to “Libstock Discussion”