Skip to content
Snippets Groups Projects
Commit 60fc9053 authored by Moe Jette's avatar Moe Jette
Browse files

Removed redundant QA tests slurm_protocol_stream_client.c and

slurm_protocol_stream_server.c. see equivalents in testsuite/stream*
parent fd6ec348
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,6 @@ else ...@@ -6,6 +6,6 @@ else
elan_testprogs = elan_testprogs =
endif endif
noinst_PROGRAMS = $(elan_testprogs) slurm_protocol_stream_client slurm_protocol_stream_server noinst_PROGRAMS = $(elan_testprogs)
LDADD = $(top_srcdir)/src/common/libcommon.la LDADD = $(top_srcdir)/src/common/libcommon.la
#include <src/common/slurm_protocol_api.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main ( int argc , char * argv[] )
{
/* declare file descriptors */
slurm_fd worker_socket ;
/* declare address structures */
slurm_addr worker_address ;
unsigned int buffer_len = 1024 ;
char buf_temp [ buffer_len ] ;
char * buffer = buf_temp ;
char * test_send = "This is a test of simple socket communication" ;
unsigned int test_send_len = strlen ( test_send ) ;
unsigned int length_io ;
/* init address sturctures */
slurm_set_addr_uint ( & worker_address , 7000 , SLURM_INADDR_ANY ) ;
/* connect socket */
worker_socket = slurm_open_stream ( & worker_address ) ;
length_io = slurm_read_stream ( worker_socket , buffer , buffer_len ) ;
printf ( "Bytes Recieved %i\n", length_io ) ;
length_io = slurm_write_stream ( worker_socket , test_send , test_send_len ) ;
printf ( "Bytes Sent %i\n", length_io ) ;
slurm_close_stream ( worker_socket ) ;
return 0 ;
}
#include <netinet/in.h>
#include <src/common/slurm_protocol_api.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main ( int argc , char * argv[] )
{
/* declare file descriptors */
slurm_fd listen_socket ;
slurm_fd worker_socket ;
/* declare address structures */
slurm_addr listen_address ;
slurm_addr worker_address ;
unsigned int buffer_len = 1024 ;
char buf_temp [ buffer_len ] ;
char * buffer = buf_temp ;
char * test_send = "This is a test of simple socket communication" ;
unsigned int test_send_len = strlen ( test_send ) ;
unsigned int length_io ;
/* init address sturctures */
slurm_set_addr_uint ( & listen_address , 7000, SLURM_INADDR_ANY ) ;
/* open and listen on socket */
listen_socket = slurm_listen_stream ( & listen_address ) ;
/* accept socket */
while ( true )
{
worker_socket = slurm_accept_stream ( listen_socket , & worker_address ) ;
length_io = slurm_write_stream ( worker_socket , test_send , test_send_len ) ;
printf ( "Bytes Sent %i\n", length_io ) ;
length_io = slurm_read_stream ( worker_socket , buffer , buffer_len ) ;
printf ( "Bytes Recieved %i\n", length_io ) ;
}
slurm_close_stream ( worker_socket ) ;
slurm_close_stream ( listen_socket ) ;
return 0 ;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment