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.

Client TCP LwIP + stm32f107

Status
Not open for further replies.

sebus_1985

Newbie level 3
Joined
Jul 27, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Poland
Activity points
1,301
Hello. Sorry for my english.I don't have any experience in programming TCP, and I have a problem with LwIP. I want to make a tcp client on the stm32f107 (butterfly board from kamami.pl) which will connect to server on my computer. I found a python server code which is the best for me. Is there someone who knows how to start a client. I know how the tcp protoclol works but i don't know how this library works and what function should I use. There is some code which i made but it doesn't work. I used a stm32 demo library.
Code:
struct ip_addr server_ip;
struct ip_addr client_ip;
...
void HelloWorld_init(void)
{
    IP4_ADDR(&server_ip,192,168,0,6);
    IP4_ADDR(&client_ip,192,168,0,33);
  struct tcp_pcb *pcb;	            		
  
  /* Create a new TCP control block  */
  pcb = tcp_new();	                		 	

  /* Assign to the new pcb a local IP address and a port number */
  /* Using IP_ADDR_ANY allow the pcb to be used by any local interface */
  tcp_bind(pcb, &client_ip, 80);     

  //tcp_connect(pcb, &server_ip, 80, tcp_client_connected_l); 
  //int i;
  //for(i=0;i<2000;i++);
  
  //tcp_write(pcb, HELLO, strlen(HELLO), 1);


  /* Set the connection to the LISTEN state */
  //pcb = tcp_listen(pcb);				

  /* Specify the function to be called when a connection is established */	
  tcp_accept(pcb, HelloWorld_accept); 
  tcp_connect(pcb, &server_ip, 80, tcp_client_connected_l);   
  tcp_write(pcb, HELLO, strlen(HELLO), 1);
										
}
 

I have read this document, and I try to do the same way as they say. No effect. I instaled sniffer, some frames are sended (i am guesing it is a SYN) and then I am trying to send something but the tcp_write() sending nothing.
 

Ok I found a solution. In lwipopt.h I disable the DHCP mode and now works fine.
 

Hi,
can you post the whole code for implementing the TCP Client using RAW API. I am trying to achieve the same but some how I am not able to connect my Client to the Server.
Thanks,
Techie
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top