CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

UDP protocol : send from PC to PIC 18F4620

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mouns



Joined: 16 Apr 2008
Posts: 1

View user's profile Send private message

UDP protocol : send from PC to PIC 18F4620
PostPosted: Fri Apr 18, 2008 9:08 am     Reply with quote

hello,
I try to send UDP packets from a PC, i send this frame thanks to a software that i developed and it works correctly.
When i send the frames i switch the network thank to ethereal and none UDP frame are displayed.
i join my souce code.
I have a good connexion but i don't receive datas .

#define UDP_SOURCE_PORT 3000
#define UDP_DESTINATION_PORT 3001
#define UDP_NUM_LISTEN_SOCKETS 2
#define STACK_USE_UDP 1
#define MAX_SOCKETS 6
#define MAX_UDP_SOCKETS 4

#include "ccstcpip.h"
#include "tcpip\udp.h"


void main(void) {

MAC_ADDR mac_dest; //Variable structurée pour l'affectation de l'adresse MAC du destinataire
static UDP_SOCKET MySocket=INVALID_UDP_SOCKET;

NODE_INFO remote;
int i,len;

char *Transmission_OK;
char *Transmission_Failed;
char *reception;
char c;
Transmission_OK ="Data progress..."; //Status de la transmission
Transmission_Failed="Data progress failed"; //Status de la transmission

init_user_io();
MACAddrInit();
IPAddrInit(); //Initialisation de l'adresse IP
//MACInit(); //Initialisation de l'adresse MAC
// Adress MAC de destination prise en compte
/*mac_dest.v[0]=0xFF;
mac_dest.v[1]=0xFF;
mac_dest.v[2]=0xFF;
mac_dest.v[3]=0xFF;
mac_dest.v[4]=0xFF;
mac_dest.v[5]=0xFF; */


lcd_init(); // Initialisation du LCD
//TickInit(); //Initialisation des composant TCP/IP
StackInit();

printf(lcd_putc,"Test UDP V1.0"); delay_ms(2000);lcd_putc('\n');
i=0;
//UDPInit();
MySocket=UDPOpen(UDP_SOURCE_PORT,NULL,0);
if(MySocket==INVALID_UDP_SOCKET) {printf(lcd_putc,"Echec Connexion");
delay_ms(2000);break;}
else{
printf(lcd_putc,"Connexion OK"); delay_ms(2000);
while(TRUE) {
lcd_putc('\f');


if (UDPIsGetReady(MySocket)){
// reception du paquet envoyé par le PC
while(UDPGet(&c)){
reception[i]=c;
i++;
printf(lcd_putc,reception);
}
UDPDiscard();
}
else printf(lcd_putc,"Echec reception");
//Fermeture de la connection
UDPClose(MySocket);
delay_ms(1000);
StackTask();
}
}
}

thank you
Best regards
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group