SCTP Discussions

Text archives Help


AW: [SCTP-Discussion] How to modify certain parameters?


Chronological Thread 
  • From: Tuexen Michael <michael.tuexen AT siemens.com>
  • To: "'Oon Heok Kee'" <oonheokkee78 AT hotmail.com>, discussion AT sctp.de
  • Subject: AW: [SCTP-Discussion] How to modify certain parameters?
  • Date: Wed Aug 28 10:12:02 2002
  • List-id: SCTP Discussions <discussion.sctp.de>

Dear all,

see my commments below.

Best regards
Michael

Michael Tuexen Tel.: +49 89 722 47210
Siemens AG Fax: +49 89 722 48212
ICN WN CC SE 7 e-mail:
Michael.Tuexen AT siemens.com

> -----Ursprüngliche Nachricht-----
> Von: Oon Heok Kee
> [mailto:oonheokkee78 AT hotmail.com]
> Gesendet: Dienstag, 27. August 2002 15:58
> An:
> discussion AT sctp.de
> Betreff: [SCTP-Discussion] How to modify certain parameters?
>
>
> Hi,
>
> I'm presently running on kernel 2.4.18-3, installed with
> socketapi-1.0.0
> and sctplib-1.0.0-pre19.
>
> I have a small piece of echo-server program running on SCTP. It's
> presently running with a single pair of in and out stream. I
> would like to
> know how I can modify certain parameters, in particular:
>
The API is described in
http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpsocket-04.txt
> no. of in/out streams supported
See section 7.1.3 of the above document.
> no. of retransmission
See section 7.1.14 of the above docuement.
> level of reliability
See section 7.1.12 of the above document. Please not that we
have not implemented PR-SCTP right now. We support an older
version. PR-SCTP will be supported in a future release.
>
> and other stuff like that so that I can have some packets
> delivered with
> higher reliability and more number of streams in 1
> association. Is there any
> central configuration file where all these configuration
> parameters are
> located? It would be good if anyone can give me an example of
> how to change
> the configurations.
>
> I have also checked my program on Ethereal, and it seems
> like I'm always
> getting an error on the Adler32 checksum. The program works perfectly
> though. Are there any known errors on this?
>
This is somethink I did not check for the pre19 release. It uses
CRC32C as the default checksum routine. So everything is working but
ethereal state (correctly) that the Adler-32 checksum is wrong. Please
use a recent version of ethereal (0.9.6 is the newest) and
- go to the Edit Menu.
- select the Preferences.
- select Protocols on the left hand side of that window.
- select SCTP there
- choose 'Checksum type' Automatic
- Click Apply, Save and OK.
Now Ethereal checks if a packet use Adler 32 or CRC32c and displays
that information.
> Thank you very much, and hope to hear from any of the good
> Samaritans out
> there... :)
>
>
>
>
> Regards,
> Oon, Heok Kee
>
> P.S. I've attached my codes below, and I hope it helps...
>
> ***********************************************************
> /**** Echo Server Example ****/
>
> /* SCTP server */
>
> /* Compile this file with "gcc -o sctp_server sctp_server.c
> -lsctpsocket
> -lsctp -lglib -lstdc++ -lpthread". */
>
> #include <stdio.h> /* for printf() and fprintf() */
> #include <sys/socket.h> /* for socket(), bind(), and connect() */
> #include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
> #include <stdlib.h> /* for atoi() */
> #include <string.h> /* for memset() */
> #include <unistd.h> /* for close() */
> #include <sys/types.h>
> #include <sys/time.h>
> #include <ext_socket.h>
> #include <net/route.h>
> #include <net/if.h>
> #include <netinet/in.h>
> #include <sctp.h>
>
>
> #define MAXPENDING 5 /* Maximum outstanding connection requests */
> #define RCVBUFSIZE 16 /* Size of receive buffer */
>
>
> void DieWithError(char *errorMessage)
> {
> perror(errorMessage);
> exit(1);
> }
>
>
> void HandleSCTPClient(int clntSocket)
> {
> char *echoBuffer/*[RCVBUFSIZE]*/; /* Buffer for echo string */
> int recvMsgSize; /* Size of received message */
>
> printf("Receiving message from client...\n\n");
>
> printf("Message received: ");
> do{
> recvMsgSize = 0;
> if ((recvMsgSize = ext_recv(clntSocket,
> echoBuffer, (RCVBUFSIZE-1), 0)) <
> 0)
> DieWithError("recv() failed");
> echoBuffer[recvMsgSize] = '\0';
> printf("%s", echoBuffer);
> if (ext_send(clntSocket, echoBuffer,
> recvMsgSize, 0) != recvMsgSize)
> DieWithError("send() failed");
> } while (recvMsgSize > 0);
>
> /*free(&echoBuffer);*/
> printf("\n\nClosing connection... ");
> ext_close(clntSocket); /* Close client socket */
> printf("Connection closed.\n\n");
> }
>
>
> int main(int argc, char *argv[])
> {
> int fd;
> int servSock; /* Socket descriptor for server */
> int clntSock; /* Socket descriptor for client */
> struct sockaddr_in echoServAddr; /* Local address */
> struct sockaddr_in echoClntAddr; /* Client address */
> struct sctp_assoc_change *sac;
> unsigned int clntLen; /* Length of client address */
> unsigned short echoServPort; /* Server port */
>
> if (argc != 2) /* Test for correct number of arguments */
> {
> fprintf(stderr, "Usage: %s <Server Port>\n", argv[0]);
>
> exit(1);
> }
>
> echoServPort = atoi(argv[1]); /* First arg: local port */
>
> printf("\nCreating socket... ");
> /* Create socket for incoming connections */
> if ((servSock = ext_socket(PF_INET, SOCK_STREAM,
> IPPROTO_SCTP))<0)
> DieWithError("socket() failed");
> printf("Socket created.\n\n");
>
> /* Construct local address structure */
> /* Zero out structure */
> memset(&echoServAddr, 0, sizeof(echoServAddr));
>
> echoServAddr.sin_family = AF_INET;/* Internet addr. family */
>
> /* Any incoming interface */
> echoServAddr.sin_addr.s_addr = htonl(INADDR_ANY);
>
> echoServAddr.sin_port = htons(echoServPort); /* Local port */
>
> printf("Binding to address... ");
> /* Bind to the local address */
> if (ext_bind(servSock, (struct sockaddr *) &echoServAddr,
> sizeof(echoServAddr)) < 0)
> DieWithError("bind() failed");
> printf("Address bounded.\n\n");
>
> /* Mark the socket so it will listen for incoming conn. */
> if (ext_listen(servSock, MAXPENDING) < 0)
> DieWithError("listen() failed");
>
> for (;;) /* Run forever */
> {
> /* Set the size of the in-out parameter */
> clntLen = sizeof(echoClntAddr);
>
> printf("Waiting for connection... ");
> /* Wait for a client to connect */
> if ((clntSock = ext_accept(servSock, (struct
> sockaddr *) &echoClntAddr,
> &clntLen)) < 0)
> DieWithError("accept() failed");
> printf("Connected.\n\n");
>
> /* clntSock is connected to a client! */
> printf("Handling client %s\n\n",
> inet_ntoa(echoClntAddr.sin_addr));
>
> HandleSCTPClient(clntSock);
> }
> }
> ********************************************************************
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
> _______________________________________________
> discussion mailing list
> discussion AT sctp.de
> http://www.sctp.de/mailman/listinfo/discussion
>




Archive powered by MHonArc 2.6.19+.

Top of page