ranju4u6
Newbie level 3
hi,
I am a PG scholar , my final yr project is implementing a web server in w7100 for control applications.
I am new with this kit and I created a socket and I am able to establish connection with the socket.
but i donno how to do the communication part ie, once if the connection is established , how can i send a response to a html page.?
I am posting my main() fuction here......plz help me
void main()
{
uint8 xdata S_Stat=0; //socket initialization status
uint8 L_Stat=0; //Listen status
uint8 xdata E_Stat=0;
SOCKET s=1;
uint16 port=5000;
//start of initialization part................source TCPIP driver user guide
Init_iMCU(); //initialize the kit
Init_Network(); //initialize the network parameters.
//end of initialization part
//.............................................................................................................................................volatile part
//Data Comm part begins..................source at pg no.107
while(1)
{
switch (getSn_SR(s))
{
case SOCK_CLOSED: /* if a socket is closed */
close(s);
socket(s,Sn_MR_TCP,port,0x00); //SOCKET INITIALIZATION;RETURNS 1 IF PROPERLY INITIALIZED
break;
case SOCK_INIT: /* if a socket is initiated */
L_Stat=listen(s); //LISTEN SOCKET (FOR SERVER MODE);RETURNS 1, NORMALLY WHEN SOCKET STATUS REG. IS SOCK_LISTEN(don't know how it works here).
break; //IF SUCESSFUL IT'LL GO TO SOCK_ESTABLISHED STATE.
case SOCK_ESTABLISHED:
if(getSn_IR(s) & Sn_IR_CON) // check Sn_IR_CON bit
{
evb_set_lcd_text(1,(uint8 *)"Connected from client!!");
setSn_IR(s,Sn_IR_CON); // clear Sn_IR_CON
}
//send( s,(uint8 *) "HELLO WORLD", 11 ); //PROBLEM HEREEEEEEEEEEEEEEEEEEEEEE............................
break;
case SOCK_CLOSE_WAIT:
disconnect(s);
break;
}
}
//Data comm part ends.
//..............................................................................................................................................volatile part ends here
}
I am getting the output "Connected from client!!" on LCD when i tried https://192.168.0.2:5000/ on ie's url.
how to proceed from here if i want to get an html page as response?
my send function is: uint16 send(SOCKET s, const uint8 * buf, uint16 len);
I am a PG scholar , my final yr project is implementing a web server in w7100 for control applications.
I am new with this kit and I created a socket and I am able to establish connection with the socket.
but i donno how to do the communication part ie, once if the connection is established , how can i send a response to a html page.?
I am posting my main() fuction here......plz help me
void main()
{
uint8 xdata S_Stat=0; //socket initialization status
uint8 L_Stat=0; //Listen status
uint8 xdata E_Stat=0;
SOCKET s=1;
uint16 port=5000;
//start of initialization part................source TCPIP driver user guide
Init_iMCU(); //initialize the kit
Init_Network(); //initialize the network parameters.
//end of initialization part
//.............................................................................................................................................volatile part
//Data Comm part begins..................source at pg no.107
while(1)
{
switch (getSn_SR(s))
{
case SOCK_CLOSED: /* if a socket is closed */
close(s);
socket(s,Sn_MR_TCP,port,0x00); //SOCKET INITIALIZATION;RETURNS 1 IF PROPERLY INITIALIZED
break;
case SOCK_INIT: /* if a socket is initiated */
L_Stat=listen(s); //LISTEN SOCKET (FOR SERVER MODE);RETURNS 1, NORMALLY WHEN SOCKET STATUS REG. IS SOCK_LISTEN(don't know how it works here).
break; //IF SUCESSFUL IT'LL GO TO SOCK_ESTABLISHED STATE.
case SOCK_ESTABLISHED:
if(getSn_IR(s) & Sn_IR_CON) // check Sn_IR_CON bit
{
evb_set_lcd_text(1,(uint8 *)"Connected from client!!");
setSn_IR(s,Sn_IR_CON); // clear Sn_IR_CON
}
//send( s,(uint8 *) "HELLO WORLD", 11 ); //PROBLEM HEREEEEEEEEEEEEEEEEEEEEEE............................
break;
case SOCK_CLOSE_WAIT:
disconnect(s);
break;
}
}
//Data comm part ends.
//..............................................................................................................................................volatile part ends here
}
I am getting the output "Connected from client!!" on LCD when i tried https://192.168.0.2:5000/ on ie's url.
how to proceed from here if i want to get an html page as response?
my send function is: uint16 send(SOCKET s, const uint8 * buf, uint16 len);