Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

embedded web server doubt

Status
Not open for further replies.

ranju4u6

Newbie level 3
Joined
Aug 21, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,335
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);
 

You have to use the accept API to allow multiple connections and to have something to decode the HTTP requests to respond with the proper action.
In this link **broken link removed**, pick any open source webserver and follow the example of using the sockets.
--
Amr Ali
 

thnk you for the reply,

Actually I am not looking for connection from multiple clients, since its a control application.
I managed to put the HTML page into the data memory (00-FF)of w7100.
as I'm not good in pointers I have trouble in sending this HTML page using send fuction( uint16 send(SOCKET s, const uint8 * buf, uint16 len)).

If someone can help me to send the file availavle in the data memory using this send() function, it'll b really helpful.
 

Can you share the code?
--
Amr Ali
 

Hello,

In the w7100 ,256Byte of data flash (00 -> FF) is reserved to save IP SUBMASK, MAC address ect.
not designed to put your web pages


best regards.
 

Can you share the code?
--
Amr Ali

Re. Sure ......
I already shared my main function at the begining of this discussion.


This is where I got stuck.

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 here
break;


this is the 1st time i’m doing socket programming. So As I understood correctly SOCK_ESTABLISHED is the condition that we use to communicate with the client(using html).

For that purpose I am trying to use send() function(i need to send an html page back to client).

I am attaching a file which has send() fuction and its related functions , with ERROR lines mentioned by comments.







________________________________________
Hello,

In the w7100 ,256Byte of data flash (00 -> FF) is reserved to save IP SUBMASK, MAC address ect.
not designed to put your web pages



Re. Thnkx for the inf.
But there are seperate registers for IP,GW,SubnetMask etc.........right!!? like SIPR for IP
If the data memory is for that purpose, it’ll b nice if you can give me some information about how can i store a web page in wiznet W7100 & how to access it.
 

hello


SIPR registry is actually part of the data flash just works virtually 0xFE000000 position, mystery of memory remap jej



regards..
 

Check **broken link removed** for an example of Bascom-8051 and the W7100. Got webserver running, NTP, UDP etc. etc. But got also problems to get hold of the external RAM with the Bascom-8051 $default XRAM command.

Have fun
Ben Zijlstra
 

I downloaded bascom and when I compiled I am getting errors like

"Error 8: out of internal memory in file:........".....
how can i resolve this?
 

You have downloaded the demoversion and it can generate a hex-file of 4 Kbytes.
Or you did not get the last version 1.11.98.

There is flash, 64 Kbyte, 64 Kbyte SRAM, 64 Kbyte TCP/IP-Ram, a bootrom and there is 256 byte dataflash. Got all working in Bascom-AVR except for the 256 byte dataflash. You have to read and write to it through routines in the bootrom.

But I will find it...

Have fun
Ben Zijlstra
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top