Sorry:
I am not sure whether it is the right place to ask this question. if
not, do please tell me ,where I should ask the question.
I write a small sctp server program, but when build with
cc(sunstudio11,cc -g server.c -lnsl -lsocket -lsctp) in soalris 10, it always
return error, but works well when build with /usr/sfw/gcc -g server.c -lnsl
-lsocket -lsctp.
when build with cc, the program keeps saying: "sctp_failed: 11:Resource
temporarily unavailable"
what should I do, as I want to use cc.thanks.
following is my program:
#include <sys/socket.h> /* basic socket definitions */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <errno.h>
#include <arpa/inet.h> /* inet(3) functions */
#include <netinet/sctp.h> /* note if sctp does not exist we blow up :> */
#include<stdlib.h>
#include <string.h>
#include<strings.h>
#define BUFFSIZE 100
#define SERV_PORT 8080
#define SA struct sockaddr
int
main(int argc, char **argv)
{
int sock_fd, msg_flags;
char readbuf[BUFFSIZE];
struct sockaddr_in servaddr, cliaddr;
struct sctp_sndrcvinfo sri;
struct sctp_event_subscribe evnts;
int stream_increment = 1;
socklen_t len;
int rd_sz;
sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
// sock_fd = socket(AF_INET, SOCK_STREAM, 0);
memset(&servaddr,0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
if(bind(sock_fd, (SA *) & servaddr, sizeof(servaddr))<0)
--
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code