[PD-cvs] externals/mrpeach/net tcpserver.c,1.1,1.2
Martin Peach
mrpeach at users.sourceforge.net
Tue Nov 7 22:17:53 CET 2006
- Previous message: [PD-cvs] externals/iemlib/src/iemlib2 iem_anything_kernel.c, 1.4, NONE iem_append_kernel.c, 1.4, NONE iem_prepend_kernel.c, 1.4, NONE iem_receive_kernel.c, 1.4, NONE iem_send_kernel.c, 1.4, NONE prepend_kernel.c, 1.5, NONE
- Next message: [PD-cvs] externals/mrpeach/net tcpclient.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/mrpeach/net
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13171
Modified Files:
tcpserver.c
Log Message:
added file send
Index: tcpserver.c
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/net/tcpserver.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tcpserver.c 24 Aug 2006 06:51:16 -0000 1.1
--- tcpserver.c 7 Nov 2006 21:17:51 -0000 1.2
***************
*** 38,42 ****
//#include <errno.h>
//#include <string.h>
! //#include <stdio.h>
//#include <pthread.h>
#if defined(UNIX) || defined(unix)
--- 38,42 ----
//#include <errno.h>
//#include <string.h>
! #include <stdio.h>
//#include <pthread.h>
#if defined(UNIX) || defined(unix)
***************
*** 112,118 ****
static void *tcpserver_new(t_floatarg fportno);
static void tcpserver_free(t_tcpserver *x);
- #ifdef MSW
- __declspec(dllexport)
- #endif
void tcpserver_setup(void);
--- 112,115 ----
***************
*** 247,251 ****
{
static char byte_buf[MAX_UDP_RECEIVE];// arbitrary maximum similar to max IP packet size
! int i, d;
unsigned char c;
float f, e;
--- 244,248 ----
{
static char byte_buf[MAX_UDP_RECEIVE];// arbitrary maximum similar to max IP packet size
! int i, j, d;
unsigned char c;
float f, e;
***************
*** 259,267 ****
int late;
int sockfd = x->x_fd[client];
/* process & send data */
if(sockfd >= 0)
{
! for (i = 0; i < argc; ++i)
{
if (argv[i].a_type == A_FLOAT)
--- 256,266 ----
int late;
int sockfd = x->x_fd[client];
+ char fpath[MAX_PATH];
+ FILE *fptr;
/* process & send data */
if(sockfd >= 0)
{
! for (i = j = 0; i < argc; ++i)
{
if (argv[i].a_type == A_FLOAT)
***************
*** 287,299 ****
post("%s: argv[%d]: %d", objName, i, c);
#endif
! byte_buf[i] = c;
}
else
{
! error("%s: item %d is not a float", objName, i);
return;
}
}
! length = i;
if (length > 0)
{
--- 286,331 ----
post("%s: argv[%d]: %d", objName, i, c);
#endif
! byte_buf[j++] = c;
! }
! else if (argv[i].a_type == A_SYMBOL)
! {
!
! atom_string(&argv[i], fpath, MAX_PATH);
! #ifdef DEBUG
! post ("%s: fname: %s", objName, fpath);
! #endif
! fptr = fopen(fpath, "rb");
! if (fptr == NULL)
! {
! post("%s: unable to open \"%s\"", objName, fpath);
! return;
! }
! rewind(fptr);
! #ifdef DEBUG
! post("%s: d is %d", objName, d);
! #endif
! while ((d = fgetc(fptr)) != EOF)
! {
! byte_buf[j++] = (char)(d & 0x0FF);
! #ifdef DEBUG
! post("%s: byte_buf[%d] = %d", objName, j-1, byte_buf[j-1]);
! #endif
! if (j >= MAX_UDP_RECEIVE)
! {
! post ("%s: file too long, truncating at %lu", objName, MAX_UDP_RECEIVE);
! break;
! }
! }
! fclose(fptr);
! fptr = NULL;
! post("%s: read \"%s\" length %d byte%s", objName, fpath, j, ((d==1)?"":"s"));
}
else
{
! error("%s: item %d is not a float or a file name", objName, i);
return;
}
}
! length = j;
if (length > 0)
{
***************
*** 604,610 ****
}
- #ifdef MSW
- __declspec(dllexport)
- #endif
void tcpserver_setup(void)
{
--- 636,639 ----
- Previous message: [PD-cvs] externals/iemlib/src/iemlib2 iem_anything_kernel.c, 1.4, NONE iem_append_kernel.c, 1.4, NONE iem_prepend_kernel.c, 1.4, NONE iem_receive_kernel.c, 1.4, NONE iem_send_kernel.c, 1.4, NONE prepend_kernel.c, 1.5, NONE
- Next message: [PD-cvs] externals/mrpeach/net tcpclient.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list