thanks for your replies, I am using different ports as well for Client and
Server.
Let me post my simple code here
*Server code*
void *udp_server_1(void *arg)
{
int sock;
struct sockaddr_in ServAddr;
struct sockaddr_in ClientAddr;
char serv_buff[1024];
int i, bytes_recvd, ServLen, ClientLen;
sock = lwip_socket(AF_INET, SOCK_DGRAM, 0);
ServAddr.sin_family = AF_INET;
ServAddr.sin_len = sizeof(ServAddr);
ServAddr.sin_addr.s_addr = inet_addr("192.168.2.200");
ServAddr.sin_port = 7900;
ClientAddr.sin_family = AF_INET;
ClientAddr.sin_len = sizeof(ClientAddr);
ClientAddr.sin_addr.s_addr = inet_addr("192.168.2.200");
ClientAddr.sin_port =9200;
ServLen = sizeof(ServAddr);
ClientLen = sizeof(ClientAddr);
lwip_bind(sock, (struct sockaddr*)&ServAddr, sizeof(ServAddr));
bytes_recvd = lwip_recvfrom(sock, serv_buff, sizeof(serv_buff), 0,
(struct sockaddr*)&ClientAddr, (socklen_t *)&ClientLen);
serv_buff[bytes_recvd] = '\0';
printf("%s", serv_buff); // Here I would expect the message *'This is
the Client sending message'*, which I cannot see
lwip_close(sock);
}
*
Client Code:*
void *udp_client_1(void *arg)
{
int sock;
struct sockaddr_in ServAddr;
struct sockaddr_in ClientAddr;
char reply_client[] = "This is the Client sending message";
char client_buff[1024];
int i, ServLen, ClientLen;
sock = lwip_socket(AF_INET, SOCK_DGRAM, 0);
ServAddr.sin_family = AF_INET;
ServAddr.sin_len = sizeof(ServAddr);
ServAddr.sin_addr.s_addr = inet_addr("192.168.2.200");
ServAddr.sin_port = 7900;
ClientAddr.sin_family = AF_INET;
ClientAddr.sin_len = sizeof(ClientAddr);
ClientAddr.sin_addr.s_addr = inet_addr("192.168.2.200");
ClientAddr.sin_port = 9200;
ServLen = sizeof(ServAddr);
ClientLen = sizeof(ClientAddr);
lwip_sendto(sock, reply_client, sizeof(reply_client), 0, (struct
sockaddr*)&ServAddr, sizeof(ServAddr));
lwip_close(sock);
}
main loop
void main()
{
pthread_t udp_server_thread;
pthread_t udp_client_thread;
pthread_create(&udp_client_thread, NULL, udp_client_1, NULL);
pthread_create(&udp_server_thread, NULL, udp_server_1, NULL);
}
I can see the bind and sendto are functioning good as I have checked it with
the 'if' and 'else' conditions. But I cannot receive any string message from
the client which I wanted tp print it on my console output.
Can anybody let me know where I am making the mistake
On Wed, Apr 27, 2011 at 4:40 PM, wondra <won...@volny.cz> wrote:
> I do not agree. Wireshark works well with the ‘lo’ interface, as does
> tcpdump. (Tested right now on Debian 6.)
>
>
>
> -----Original Message-----
> *From:* Alexandre Cote [mailto:ac...@media5corp.com]
> *Sent:* Wednesday, April 27, 2011 2:57 PM
> *To:* rakeen siena; sipp-users@lists.sourceforge.net
> *Subject:* Re: [Sipp-users] Client and Server using the same IP Address
>
>
>
> It is normal in your case to not see anything using Wireshark because it’s
> on the same PC and the packets will not get out of the physical interface.
> You can’t see loopback packets when using Wireshark.
>
>
>
> Did you set different UDP port? I’m using a SIPP client and server on the
> same machine and I have no problem.
>
>
>
>
>
> *De :* rakeen siena [mailto:rakeen.si...@googlemail.com]
> *Envoyé :* 27 avril 2011 05:21
> *À :* sipp-users@lists.sourceforge.net
> *Objet :* [Sipp-users] Client and Server using the same IP Address
>
>
>
> Hi,
> initially I started to set up a Client and then a Server, tested them. Both
> were working fine when they were running on different machines, but now I
> thought of combining them in the same source code and run them on the same
> machine. The result is that I can see no connection between the Client and
> the Server. Since I am trying to run it on the same machine in both cases
> the IP Address is the same, I have initialized both of them with the same IP
> Address.But still I could not establish a connection. I am using UDP for
> sending and receiving the data between the Client and the Server. Any
> mistake I am making in this case or any important thing I have forgot to
> initialize.
>
> For example on Server side:
> ServAddr.sin_addr.s_addr = inet_addr("1.2.3.4");
>
> On Client side:
> ClientAddr.sin_addr.s_addr = inet_addr("1.2.3.4");
>
> I cant even sniff any data transfer using wireshark.
>
> Regards
> Rakeen
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Sipp-users mailing list
> Sipp-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sipp-users
>
>
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users