Well, thanks anyway.
Regarding:
SurferTim:
2) the UDP packet is limited to 96 bytes or smaller. Anything larger causes a fail.
I have noticed that, to be precisly it is 90bytes.As i have experienced that I have wasted a lot of my time on that issue... In case someone else get into the forum and read it... just to mention that of course it is possible to send packages larger than 90 bytes. Actually Im sending packages of 900 bytes, I havent tried to send anything larger than that.
The thing is, when you are typing:
char message[900];
udp.beginpacket(IP,port);
udp.write(message);
udp.endPacket();
"message" can not be larger than 90bytes.
but what you could do is to split "message" in 10 parts or 11, and then:
udp.beginPacket(IP,port);
udp.write(message1);
udp.write(message2);
udp.write(message3);
etc...
udp.endPacket();
Of course this is not the most smart way to do it, but it is a good way to understand it...
In my case, what I did is the following:
1.- I create the buffer, my message.
char *createSDP() {
char temp[120];
char sdpBuffer[400];
sprintf(temp, "v=0\r\n"); strcpy(sdpBuffer, temp);
sprintf(temp, "o=- 104852528 104852528 IN IP4 %s\r\n", IP_caller); strcat(sdpBuffer, temp);
sprintf(temp, "s=-\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "c=IN IP4 %s\r\n", IP_caller); strcat(sdpBuffer, temp);
sprintf(temp, "t=0 0\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "m=audio %s RTP/AVP 0 101\r\n", charRTPport); strcat(sdpBuffer, temp);
sprintf(temp, "a=rtpmap:0 PCMU/8000\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "a=rtpmap:101 telephone-event/8000\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "a=fmtp:101 0-15\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "a=ptime:20\r\n"); strcat(sdpBuffer, temp);
sprintf(temp, "a=sendrecv\r\n"); strcat(sdpBuffer, temp);
return sdpBuffer;
}
2.-Then I create another function that it will divide the buffer in 88bytes:
void sendSDP(IPAddress IP_server, unsigned int Port) {
char* package = createSDP();
unsigned int bufferSize = 88;
char Buffer2[bufferSize + 1];
unsigned int sizePackage = strlen(package);
unsigned int j = 0;
udp.beginPacket(IP_server, Port);
for (int i = 0; i < sizePackage; i++) {
Buffer2[j] = package*;*
- j++;*
- if (j == bufferSize - 1) {*
- udp.write(Buffer2, j);*
- j = 0;*
- }*
- }*
- udp.write(Buffer2, j);*
- udp.endPacket();*
}
[/quote]
Then the whole buffer will be sent without any problem.
Once again, it might not be the most smart way of coding, but for me it was good enough to send larger packages. Hope it is understandable and good enough. I wasted a lot of time on that, so I just hope it can be useful for someone else.
Cheers!