FACT++  1.0
static int dna_write_bytes ( int  conn_id,
void *  buffer,
int  size,
int  nowait 
)
static

Definition at line 270 of file dna.c.

References DIM_WARNING, DIMTCPWRRTY, DIMTCPWRTMO, dna_report_error(), size, tcpip_failure(), Tcpip_max_io_data_write, tcpip_would_block(), tcpip_write(), and tcpip_write_nowait().

Referenced by dna_test_write(), dna_write_nowait(), and do_dna_write().

271 {
272  register int size_left, wrote;
273  register char *p;
274  int max_io_data;
275 #ifdef VMS
276  int retries = WRITE_RETRIES, retrying = 0;
277  float wait_time = 0.01;
278 #endif
279  extern int tcpip_write_nowait(int, char *, int);
280 
281  max_io_data = Tcpip_max_io_data_write;
282  p = (char *) buffer;
283  size_left = size;
284  do {
285  size = (size_left > max_io_data) ? max_io_data : size_left ;
286 #ifdef VMS
287  if(nowait)
288  {
289  while(--retries)
290  {
291  if((wrote = tcpip_write_nowait(conn_id, p, size)) > 0)
292  break;
293  if(!tcpip_would_block(wrote))
294  return(0);
295  if(retries == WRITE_RETRIES_WNG)
296  {
297  dna_report_error(conn_id, tcpip_code,
298  "Writing to (retrying)", DIM_WARNING, DIMTCPWRRTY);
299  retrying = 1;
300  }
301  lib$wait(&wait_time);
302  }
303  if(!retries)
304  {
305  return(0);
306  }
307  }
308  else
309  wrote = tcpip_write(conn_id, p, size);
310 #else
311  if(nowait)
312  {
313  wrote = tcpip_write_nowait(conn_id, p, size);
314  if(wrote == -1)
315  {
316  dna_report_error(conn_id, -1,
317  "Write timeout, writing to", DIM_WARNING, DIMTCPWRTMO);
318  wrote = 0;
319  }
320  }
321  else
322  {
323  wrote = tcpip_write(conn_id, p, size);
324  }
325 #endif
326 
327  if( tcpip_failure(wrote) )
328  return(0);
329  p += wrote;
330  size_left -= wrote;
331  } while(size_left > 0);
332  return(1);
333 }
#define DIMTCPWRRTY
Definition: dim_common.h:294
#define DIMTCPWRTMO
Definition: dim_common.h:295
int tcpip_would_block(int code)
Definition: tcpip.c:1545
int tcpip_write_nowait(int conn_id, char *buffer, int size)
Definition: tcpip.c:1435
void dna_report_error(int conn_id, int code, char *routine_name, int severity, int errcode)
Definition: dna.c:903
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
int size
Definition: db_dim_server.c:17
int tcpip_write(int conn_id, char *buffer, int size)
Definition: tcpip.c:1389
int Tcpip_max_io_data_write
Definition: tcpip.c:110
int tcpip_failure(int code)
Definition: tcpip.c:1540

+ Here is the call graph for this function:

+ Here is the caller graph for this function: