Changeset 342:30e5d08c39fd in roaraudio for libroaryiff


Ignore:
Timestamp:
07/29/08 22:23:11 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

done some basic coding for connecting and disconnecting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaryiff/connection.c

    r339 r342  
    44 
    55YConnection *YOpenConnection (const char *start_arg, const char *con_arg) { 
    6  YConnection * con = malloc(sizeof(YConnection)); 
     6 YConnection * ycon = malloc(sizeof(YConnection)); 
     7 struct roar_connection con; 
     8 char * server = (char *)con_arg; 
     9 char * name   = "libroaryiff client"; 
    710 
    8  memset(con, 0, sizeof(YConnection)); 
     11 memset(ycon, 0, sizeof(YConnection)); 
    912 
    10  return con; 
     13 // there is no symbolic value for default con_arg 
     14 // in the heder files. So we use a hard coded value from the docs 
     15 
     16 if ( strcmp(server, "127.0.0.1:9433") == 0 || 
     17      strcmp(server, "127.0.0.1")      == 0 ||   // \\                                         // 
     18      strcmp(server, "localhost")      == 0 ||   //   => Don't know if this is valid for libY  // 
     19      strcmp(server, "localhost:9433") == 0 ) {  // //   but we support it.                    // 
     20 
     21  server = NULL; // try default locations 
     22 } 
     23 
     24 if (roar_simple_connect(&con, server, name) == -1) { 
     25  // Handle start_arg here! 
     26  free(ycon); 
     27  return NULL; 
     28 } 
     29 
     30 ycon->fd = con.fh; 
     31 
     32 return ycon; 
    1133} 
    1234 
     
    1537  return; 
    1638 
     39 roar_simple_close(connection->fd);  // roard will clean up all other sockets if the close the main one. 
     40 
     41 
     42 free(connection); 
    1743} 
    1844 
Note: See TracChangeset for help on using the changeset viewer.