accept() function

bridged with qdn.public.qnxrtp.newuser
Bill Caroselli

Re: accept() function

Post by Bill Caroselli » Tue Dec 02, 2003 10:20 pm

Bill Caroselli <> wrote:

BC > BC > If he has over run the cahr array he probibly clobbered whatever comes

BC > Make that "char aeeay".

LOL Oh, never mind!

Jorge Alonso

Re: accept() function

Post by Jorge Alonso » Thu Dec 04, 2003 3:41 pm

The filename´s characters always are:
PV + channel number + "_" + date + ".dat"
p.e. : PV1_041203.dat

I have tested to show the filename (and your length too) with printf()
function, and it´s OK. Then I think the problem isn´t in filename. In any
case I have also increased the array´s size and it does not work well.

As I have commented to you I use the same function to send data (file´s
information) by serial port or tcpip. When I try to send data by serial port
I do not have any problem.

Can I use any function on file that is not open()?

Note: What is aeeay??????? I don´t understand the lasts emails:(

Bill Caroselli

Re: accept() function

Post by Bill Caroselli » Thu Dec 04, 2003 10:59 pm

Jorge Alonso <> wrote:

JA > Note: What is aeeay??????? I dont understand the lasts emails:(

Sorry. It was a typo. It was supposed to be "array".
You may notice that the e is next to the r on US keyboards.

Jorge Alonso

Re: accept() function

Post by Jorge Alonso » Fri Dec 05, 2003 1:36 pm

I have already found out the problem, but I still don´t know why.

You must put attention in the change I do :).

int DownloadFile(char* c, BOOL bTransmition) {
char szFile[20];
int fdw;
int size_read;
char buffer[100]; // I change this line (before it was:
char buffer[512]; )
char szInit[] = "$SF";
char szEnd[] = "OK#";
char szError[] = "ER#";

strcpy(szFile, "/tmp/");
strncat(szFile, &c[3], CHARSFILE);
fdw = open(szFile, O_RDONLY);
if (fdw != NULL) {
//Send data init
if (bTransmition == 0) write(g_Com1, szInicio, 3);
else send(g_client, szInit, 3, 0);
//Send data file
do {
size_read = read(fdw, buffer, sizeof(buffer)); //The
problem was in this line because the size of array was too great.
if (size_read == -1) {
//send data error
if (bTransmition == 0) write(g_Com1, szError, 3);
else send(g_client, szError, 3, 0);
return 1;
if (bTransmition == 0) write(g_Com1, buffer, size_read);
else send(g_client, buffer, size_read, 0);
}while (size_read == sizeof(buffer));
//send data end
if (bTransmition == 0) write(g_Com1, szFin, 3);
else send(g_client, szEnd, 3, 0);
return 0;

Post Reply

Return to “qdn.public.qnxrtp.newuser”