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.

[PIC] Problem with UDP over WiFi (EX16 with MRF24wb0)

Status
Not open for further replies.

larten

Junior Member level 3
Junior Member level 3
Joined
Aug 6, 2012
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,437
Hi,
I wrote some code for send and receive data using UDP but there is a strange problem. when I test send data or receive data separately it works but when I want to send the data that I receive send part won't work at all.
I hope you can help me with this.

Here is my code:

Code:
 switch (UDPState)
        {
            case UDP_OPEN_SOCKET:
// RemoteIP.v[0] = (192ul);
// RemoteIP.v[1] = (168ul);
// RemoteIP.v[2] = (1ul);
// RemoteIP.v[3] = (100ul);
                
                MyUDPSocket = UDPOpenEx(0,UDP_OPEN_SERVER,UDP_LOCAL_PORT,UDP_REMOTE_PORT);

                if (MyUDPSocket == INVALID_UDP_SOCKET)
                    break;
                else
                    UDPState = UDP_SEND;

                break;

            case UDP_SEND:
                if(!UDPIsPutReady(MyUDPSocket))
                    break;

                UDPPutString((BYTE*)buffer);
                UDPFlush();

                UDPState = UDP_LISTEN;
                break;

            case UDP_LISTEN:
                if(!UDPIsGetReady(MyUDPSocket))
                    break;

                for(i = 0; i < 20; i++)
                    buffer[i] = 0;
                
                Result = UDPGetArray((BYTE*)buffer,19);
                UDPDiscard();
                if(Result != 0)
                {
                    putsUART((unsigned int*)"UDP LISTEN = ");
                    putsUART((unsigned int*)buffer);

                    UDPState = UDP_SEND;
                }

                break;

            case UDP_CLOSE_SOCKET:

                break;

            default:
                ;
        }
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top