SCTP Discussions

Text archives Help


Re: [SCTP-Discussion] How can I build the sctp environment?


Chronological Thread 
  • From: Michael Tüxen <Michael.Tuexen AT micmac.franken.de>
  • To: renyang <javafang AT seed.net.tw>
  • Cc: sctp-discussion AT sctp.de
  • Subject: Re: [SCTP-Discussion] How can I build the sctp environment?
  • Date: Wed, 18 Mar 2009 10:19:53 +0100
  • List-archive: <http://lists.franken.de/pipermail/sctp-discussion>
  • List-id: SCTP Discussions <sctp-discussion.sctp.de>

Hi,

first you have to make a decision: Do you want to use the
Linux kernel implementation of SCTP or the userland
SCTP implementation sctplib?

Best regards
Michael

On Mar 18, 2009, at 3:06 AM, renyang wrote:

Hello, can you help me?
I have some problems in compiling the sctp code
I list what I did below, can you tell me what is wrong with the process?

Step 1, I download the sctplib-1.0.8.tar.gz and socketapi-2.2.0.tar.gz formhttp://www.sctp.de/sctp-download.html

Then, I refer the http://www.sctp.be/sctpapplic.htm to install them

for the sctplib-1.0.8.tar.gz
$ tar -zxvf sctplib-1.0.8.tar.gz
$ cd sctplib-1.0.8
$ ./configure
$ make
$ sudo makeinstall

for the socketapi-2.2.0.tar.gz
$ tar -zxvf socketapi-2.2.0.tar.gz
$ cd socketapi-2.2.0
$ ./configure
$ make
$ sudo make

The processes are ok without error.

Step2, I written a code "main.c" for testing the environment.

#include <sys/socket.h>
#include <netinet/in.h>
#include <ext_socket.h>
#include <sctp.h>
#include <string.h>

int main(int argc,char **argv)
{
int sock_fd,msg_flags;
char readbuf[1024];
struct sockaddr_in servaddr,cliaddr;
struct sctp_sndrcvinfo sri;
struct sctp_event_subscribe evnts;
socklen_t len;
size_t rd_sz;

sock_fd = socket(AF_INET,SOCK_SEQPACKET,IPPROTO_SCTP);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(265);

bind(sock_fd,(struct sockaddr *) &servaddr,sizeof(servaddr));

bzero(&evnts,sizeof(evnts));
evnts.sctp_data_io_event = 1;
setsockopt(sock_fd,IPPROTO_SCTP,SCTP_EVENTS,&evnts,sizeof(evnts));
listen(sock_fd,5);
for (;;) {
len = sizeof(struct sockaddr_in);
rd_sz = sctp_recv(sock_fd,readbuf,sizeof(readbuf),(struct sockaddr *) &cliaddr,&len,&sri,&msg_flags);

sctp_sendmsg(sock_fd,readbuf,rd_sz,(struct sockaddr *) &cliaddr,len,sri.sinfo_ppid,sri.sinfo_flags,sri.sinfo_stream,0,0);
}
return 0;
}

and I typed the command
$ gcc main.c -I/usr/local/include -L/usr/local/lib -lsctplib
/tmp/ccYJsaya.o: In function `main':
main.c:(.text+0x17f): undefined reference to `sctp_recv'
main.c:(.text+0x21a): undefined reference to `sctp_sendmsg'
collect2: ld returned 1 exit status

The code run on ubuntu 7.10 and 8.04
In the 7.10, the gcc version is 4.1.3, and I do not use the command "sudo apt-get install libsctp-dev lksctp-tools" to install the sctp library.

Can you teach me what is wrong with my process?

Thanks you!!!
_______________________________________________
sctp-discussion mailing list
sctp-discussion AT sctp.de
http://www.sctp.de/mailman/listinfo/sctp-discussion





Archive powered by MHonArc 2.6.19+.

Top of page