18462SApril.Chin@Sun.COM#!/usr/bin/ksh93 28462SApril.Chin@Sun.COM 38462SApril.Chin@Sun.COM# 48462SApril.Chin@Sun.COM# CDDL HEADER START 58462SApril.Chin@Sun.COM# 68462SApril.Chin@Sun.COM# The contents of this file are subject to the terms of the 78462SApril.Chin@Sun.COM# Common Development and Distribution License (the "License"). 88462SApril.Chin@Sun.COM# You may not use this file except in compliance with the License. 98462SApril.Chin@Sun.COM# 108462SApril.Chin@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 118462SApril.Chin@Sun.COM# or http://www.opensolaris.org/os/licensing. 128462SApril.Chin@Sun.COM# See the License for the specific language governing permissions 138462SApril.Chin@Sun.COM# and limitations under the License. 148462SApril.Chin@Sun.COM# 158462SApril.Chin@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each 168462SApril.Chin@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 178462SApril.Chin@Sun.COM# If applicable, add the following below this CDDL HEADER, with the 188462SApril.Chin@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying 198462SApril.Chin@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner] 208462SApril.Chin@Sun.COM# 218462SApril.Chin@Sun.COM# CDDL HEADER END 228462SApril.Chin@Sun.COM# 238462SApril.Chin@Sun.COM 248462SApril.Chin@Sun.COM# 25*12068SRoger.Faulkner@Oracle.COM# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 268462SApril.Chin@Sun.COM# 278462SApril.Chin@Sun.COM 288462SApril.Chin@Sun.COM# 298462SApril.Chin@Sun.COM# test_net_sctp - a simple ksh93 SCTP demo 308462SApril.Chin@Sun.COM# 318462SApril.Chin@Sun.COM 328462SApril.Chin@Sun.COMexport PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin 338462SApril.Chin@Sun.COM 348462SApril.Chin@Sun.COMset -o xtrace 358462SApril.Chin@Sun.COMset -o errexit 368462SApril.Chin@Sun.COM 378462SApril.Chin@Sun.COM# declare variables 388462SApril.Chin@Sun.COMinteger netfd 398462SApril.Chin@Sun.COMtypeset request 408462SApril.Chin@Sun.COM 418462SApril.Chin@Sun.COM# print intro 428462SApril.Chin@Sun.COMprint "# testing SCTP support" 438462SApril.Chin@Sun.COMprint "# (via fetching the main page of http://www.sctp.org/ via SCTP)" 448462SApril.Chin@Sun.COM 458462SApril.Chin@Sun.COM# open sctp stream and print it's number 4610898Sroland.mainz@nrubsig.orgredirect {netfd}<> /dev/sctp/www.sctp.org/80 478462SApril.Chin@Sun.COMprint "sctp fd=${netfd}" 488462SApril.Chin@Sun.COM 498462SApril.Chin@Sun.COM# send HTTP request 508462SApril.Chin@Sun.COMrequest="GET / HTTP/1.1\r\n" 518462SApril.Chin@Sun.COMrequest+="Host: www.sctp.org\r\n" 5210898Sroland.mainz@nrubsig.orgrequest+="User-Agent: ksh93/test_net_sctp (2009-04-08; $(uname -s -r -p))\r\n" 538462SApril.Chin@Sun.COMrequest+="Connection: close\r\n" 548462SApril.Chin@Sun.COMprint -u${netfd} -n -- "${request}\r\n" 558462SApril.Chin@Sun.COM 568462SApril.Chin@Sun.COM# print response to stdout 578462SApril.Chin@Sun.COMcat <&${netfd} 588462SApril.Chin@Sun.COM 598462SApril.Chin@Sun.COM# close connection 608462SApril.Chin@Sun.COMredirect {netfd}<&- 618462SApril.Chin@Sun.COM 628462SApril.Chin@Sun.COMprint "#done" 638462SApril.Chin@Sun.COM 648462SApril.Chin@Sun.COM#EOF. 65