lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE : [lwip-users] using 2 IP numbers at the same time


From: Frédéric BERNON
Subject: RE : [lwip-users] using 2 IP numbers at the same time
Date: Wed, 7 Nov 2007 12:20:09 +0100

>I have an ethernet interface for communication and using LwIP(LwIP 2.00.a version)
I suppose this is a release number provided by your port maintainer. Currently, last release is 1.2.0
 

>From mail group , I read that this  is possible with creating seperate network interfaces with ‘netif_add’ function.

Can you provide these mails references?

 

>In my design , I thought of creating two threads which  will establish two sockets and add seperate network interfaces at the same time.

>But it didn`t work. While I  could communicate with one IP number , the other connection could not be established.

 

I'm not sure that lwIP support that like this. Perhaps it's possible, but your driver should handle that. How do you have implemented your driver "low_level_input" calls?

 

 
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : address@hiddenr
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
 
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de KORAY KORKMAZER (MIKES INTERNET)
Envoyé : mercredi 7 novembre 2007 10:21
À : address@hidden
Objet : [lwip-users] using 2 IP numbers at the same time

Hello,

 

I am pretty new in using lwip and  want to ask your recommendations on an issue about using 2 IP numbers at the same time.

 

Let me describe my design first:

I am working on an Xilinx ML-403 platform and writing code for PPC inside the FGPGA. I have an ethernet interface for communication and using LwIP(LwIP 2.00.a version) for it.

Also using Xilinx MicroKernel.

Simply my application will have a static IP number and will communicate with another system which has a static IP number too.

 

But now another requirement has been arised. That is my application must communicate  with a second  system from an another IP number. And I still have one physical ethernet port.

This means that my application must  have 2 IP numbers. And it must listen both connections at the same time.

 

From mail group , I read that this  is possible with creating seperate network interfaces with ‘netif_add’ function.

In my design , I thought of creating two threads which  will establish two sockets and add seperate network interfaces at the same time.

But it didn`t work. While I  could communicate with one IP number , the other connection could not be established.

Here is my thread that I use for creating socket:

 

void *socket_app_thread( void *arg )

{

.....//declarations an initializations  IP, port , MAC, subnet, gw

 

   xtemacif_setmac( 0, ( u8_t* )fullmac ); //Set MAC

   IP4_ADDR( &gw, gateway[ 0 ], gateway[ 1 ], gateway[ 2 ], gateway[ 3 ] );

   //Set gateway

   IP4_ADDR( &ipaddr, ip[ 0 ], ip[ 1 ], ip[ 2 ], ip[ 3 ] ); //Set ip

   IP4_ADDR( &netmask, subnet[ 0 ], subnet[ 1 ], subnet[ 2 ], subnet[ 3 ] );

   //Set subnet msk

 

   /* allocate netif structure */

   default_netif = mem_malloc( sizeof( struct netif ) );

   if ( default_netif == NULL )

   {

      return NULL;

   }

   default_netif = netif_add( default_netif,

                              &ipaddr,

                              &netmask,

                              NULL,

                              &XTemacIf_ConfigTable[ 0 ],

                              xtemacif_init,

                              tcpip_input );

 

   netif_set_default( default_netif );

 

   /* Register XEmacHandler with interrupt controller and enable interrupts

    * with XMK

    */

   register_int_handler( XPAR_OPB_INTC_0_TRIMODE_MAC_GMII_IP2INTC_IRPT_INTR,

                         (XInterruptHandler )XTemac_IntrFifoHandler,

                         xtemacif_ptr->instance_ptr );

 

   /* Enable EMAC interrupts in XMK */

   enable_interrupt( XPAR_OPB_INTC_0_TRIMODE_MAC_GMII_IP2INTC_IRPT_INTR );

   /*-----------------------------------------------------------------------*/

   /* create socket and start application                                   */

   /*-----------------------------------------------------------------------*/

   sock = socket( AF_INET, SOCK_STREAM, 0 );

   addr.sin_family = AF_INET;

   addr.sin_port = htons( port );

   addr.sin_addr.s_addr = INADDR_ANY;

   bind( sock, ( struct sockaddr* ) &addr, sizeof( addr ) );

   listen( sock, 7);

 

   SockDesc = accept( sock, ( struct sockaddr* ) &rem, &lensock );

 

}

 

 

The second thread is similar with this one, only IP  and port number is different.

Do you have any idea where I am having mistakes?

I really appreciate for your help.

 

Thanks in advance.

Koray.

 

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]