开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

MUSIC/SP on Hercules and other topics

 

Hello,

today I registered to this group just to see if there is someone listening and if I probably find
answers to some of my questions.

I found Music/SP and the SIM390 emulator in 2011 and I took the Stanford Pascal compiler
from there and converted it into a much larger and more powerful product, called the New Stanford Pascal compiler.
The original compiler had 6.000 lines, and the new compiler today has 26.000 lines.
The new compiler is part of the VMCE distribution, and it works with VM, MVS and with
Windows, Unix, Linux, OS/2 etc., because I ported it to the non-mainframe platforms in 2016.

I did not really use Music/SP from 2011 until today, because I did not manage to get it running
with Hercules, and the SIM390 solution seemed too insecure for me ... until today; today I finally
managed to get Music/SP running with Hercules.

Now Hercules in my environment runs VM/370, MVS and MUSIC/SP and (someday hopefully) VSE.

The Pascal compiler on my Music/SP system is still the old 1982 variant which was only corrected
a little bit by Dave Edwards in 2007. But it is very different from the actual New Stanford 2023.01 variant.
Here are some informations regarding the new compiler:

I would like to send the new compiler back to Music/SP, if there is some interest in THIS community.

Now for the start some questions:

I enter Music/SP as user $000 with a modified password;
when I look into the file system, I see files in directory $000 and in directory $PSC (Pascal),
if I specify the directory name in the FLIB command. I know, that there are other
directories, for example $ADM for APL.

But: where do I get a list of ALL the directories on the system?
And maybe a map of used space vs. free space etc.?

Thank you very much in advance for your help,
kind regards

Bernd


Re: MUG Tapes anyone?

 

开云体育

A *real* MUG tape has about 6000 files and look for the TEACH program on it.

Then it's a legitimate tape.


On 7/22/2021 9:37 AM, Tom Chandler wrote:

Sir,
I have on my system in the MISC dir mugfiles.arc.? It contains 523 files.? I have not
been able to install it, trying to use applyupd.? Keep getting cannot close file message
on each entry.

If this is a different archive, I would be glad to send it to you.

Tom c.


On Wed, Jul 21, 2021 at 10:25 PM $000User <edhalbert@...> wrote:

Yeah.. that's the same set of files from another member. it's not the full MUG tape.

Thanks for checking though.

Cheers!


On 7/20/2021 10:55 AM, René Ferland wrote:
Hello Ed,
?
The zip file Yahoo-Archive/H390-music/files.zip (in the Files section) contains an other zip named mug-tape-files.zip. Have you take a look at it? Maybe your stuff is there?
?
Cheers,
?
Rene FERLAND, Montreal
?


Re: MUG Tapes anyone?

 

Sir,
I have on my system in the MISC dir mugfiles.arc.? It contains 523 files.? I have not
been able to install it, trying to use applyupd.? Keep getting cannot close file message
on each entry.

If this is a different archive, I would be glad to send it to you.

Tom c.


On Wed, Jul 21, 2021 at 10:25 PM $000User <edhalbert@...> wrote:

Yeah.. that's the same set of files from another member. it's not the full MUG tape.

Thanks for checking though.

Cheers!


On 7/20/2021 10:55 AM, René Ferland wrote:
Hello Ed,
?
The zip file Yahoo-Archive/H390-music/files.zip (in the Files section) contains an other zip named mug-tape-files.zip. Have you take a look at it? Maybe your stuff is there?
?
Cheers,
?
Rene FERLAND, Montreal
?


Re: MUG Tapes anyone?

 

开云体育

Yeah.. that's the same set of files from another member. it's not the full MUG tape.

Thanks for checking though.

Cheers!


On 7/20/2021 10:55 AM, René Ferland wrote:

Hello Ed,
?
The zip file Yahoo-Archive/H390-music/files.zip (in the Files section) contains an other zip named mug-tape-files.zip. Have you take a look at it? Maybe your stuff is there?
?
Cheers,
?
Rene FERLAND, Montreal
?


Re: MUG Tapes anyone?

 

Hello Ed,
?
The zip file Yahoo-Archive/H390-music/files.zip (in the Files section) contains an other zip named mug-tape-files.zip. Have you take a look at it? Maybe your stuff is there?
?
Cheers,
?
Rene FERLAND, Montreal
?


MUG Tapes anyone?

 

?

Does anyone have an old MUG tape laying around? I have some stuff on it, that I would like to get back.

Our site was big supporter of the MUSIC Users Group at NOVA , and for a while we managed the content and wrote the submit/extract utilities for it.?

Thank you!

-Ed


Re: server programming in "C"

 

OK well here is the sample program from my system in file?$WCC:WATC.SOCK.SAMPLE... (Note: this will not compile because there are character set errors) ... but you can see some things missing from your sample program that seem to be in mine...
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /com ** Sample Waterloo C sockets program. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /com ** See the comment about DNS servers below. ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /com ** Tests functions: connect(), send(), recv(), muresolve(), ? ? ? ? ?
? ? /com ** ? musa2e(), muse2a() ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /inc watc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? #include <socket.h> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? #include <stdio.h> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? #include <string.h> ? /* for memset(), etc. */ ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? #include <stdlib.h> ? /* for exit() */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? #include <errno.h> ? ?/* for access to errno */ ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* prototype for local function */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? static void crlf2nl(unsigned char *buf, int len); ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? int main(void) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? int i,n,rc,wlen; ? ? ?
? ? int sd; ?/* socket descriptor */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? unsigned long ipaddr; ?/* 32-bit IP address */ ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? unsigned char *sitename=""; ?/* site to connect to */ ? ?
? ? unsigned char *ipnum="132.206.120.4"; ?/* numeric IP addr to use ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? if sitename cannot be resolved by DNS */ ? ? ? ? ? ??
? ? int port=80; ? /* port number to connect to */ ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? struct sockaddr_in saddr; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? int numreads,totbytes; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? unsigned char *wrdata= ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ?"GET /msi/http/music.html HTTP/1.0\r\x25\r\x25"; ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? /* HTML request, to send to a web server. ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ?Note use of \r\x25 for CRLF. WatC Ebcdic: 0x0D 0x25. ? ? ? ? ? ?
? ? ? ? ? ? ?muse2a() and etoa() translate it to Ascii CR LF = 0x0D 0x0A. ? ?
? ? ? ? ? */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? unsigned char lastch,buf?400¨; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("\nWatC sockets sample program\n\n"); ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* Resolve the site name to an IP address */ ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /* Note: The muresolve functions uses a DNS server to lookup the ? ? ? ?
? ? ? ?IP address for the given site name (domain name).? This requires ? ??
? ? ? ?that you have 1 or more DNS server IP addresses defined in ? ? ? ? ??
? ? ? ?your $tcp:tcpip.config file, as NAMESERV records. ? ? ? ? ? ? ? ? ? ?
? ? ? ?Normally the DNS (Domain Name System) server IP addresses are ? ? ? ?
? ? ? ?provided by your ISP (Internet Service Provider). ? ? ? ? ? ? ? ? ? ?
? ? ? ?If you don't have any DNS servers, you can add the following ? ? ? ??
? ? ? ?record to file $tcp:ip.alias : ? 132.206.120.4 ? ? ??
? ? ? ?Or, in this source file, set: ?sitename="132.206.120.4" ? ? ? ? ? ? ?
? ? */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("Resolving site name %s\n",sitename); ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? rc=muresolve(sitename,&ipaddr); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(rc<0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? { printf("** Error: unable to resolve site name %s\n" ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ?" ? ? muresolve() gave rc=%d\n",sitename,rc); ? ? ? ? ? ? ? ?
? ? ? ? printf("** Using a specific numeric IP address instead: %s\n", ? ? ?
? ? ? ? ? ? ? ?ipnum); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ipaddr=inet_addr(ipnum); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? sd=socket(AF_INET,SOCK_STREAM,0); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("sd=%d from socket() create\n",sd); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(sd<0) { printf("** errno=%d\n",errno); exit(1); } ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /* Set up the socket address structure for connect() */ ? ? ? ? ? ? ? ? ?
? ? memset(&saddr,0,sizeof(saddr)); ?/* init. it to 0 */ ? ? ? ? ? ? ? ? ? ??
? ? saddr.sin_family=AF_INET; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? saddr.sin_port=htons((unsigned short)port); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? saddr.sin_addr.s_addr=ipaddr; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("Connecting to %s %s port %d\n",sitename, ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ?inet_ntoa(saddr.sin_addr),port); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? rc=connect(sd,(struct sockaddr *)&saddr,sizeof(saddr)); ? ? ? ? ? ? ? ? ?
? ? printf("rc=%d from connect()\n",rc); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(rc<0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? { printf("** errno=%d\n",errno); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? if(errno==ECONNREFUSED) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? printf(" ? ?ECONNREFUSED - Connection refused\n"); ? ? ? ? ? ? ?
? ? ? ? if(errno==EHOSTUNREACH) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? printf(" ? ?EHOSTUNREACH - Host unreachable\n"); ? ? ? ? ? ? ? ?
? ? ? ? exit(1); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* Write data to the socket */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? wlen=strlen(wrdata); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("# of bytes to be written: wlen=%d\ndata=|%s|\n",wlen,wrdata); ??
? ? muse2a(wrdata,wlen); ?/* convert from Ebcdic to Ascii! */ ? ? ? ? ? ? ??
? ? n=send(sd,wrdata,wlen,0); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(n<0) printf("** rc=%d from send(). errno=%d\n",n,errno); ? ? ? ? ? ??
? ? else printf(" %d bytes written to socket\n",n); ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* Loop to read from the socket and display the data */ ? ? ? ? ? ? ? ??
? ? if(rc<0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? { printf("** errno=%d\n",errno); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? if(errno==ECONNREFUSED) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? printf(" ? ?ECONNREFUSED - Connection refused\n"); ? ? ? ? ? ? ?
? ? ? ? if(errno==EHOSTUNREACH) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? printf(" ? ?EHOSTUNREACH - Host unreachable\n"); ? ? ? ? ? ? ? ?
? ? ? ? exit(1); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /* Write data to the socket */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? wlen=strlen(wrdata); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? printf("# of bytes to be written: wlen=%d\ndata=|%s|\n",wlen,wrdata); ??
? ? muse2a(wrdata,wlen); ?/* convert from Ebcdic to Ascii! */ ? ? ? ? ? ? ??
? ? n=send(sd,wrdata,wlen,0); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(n<0) printf("** rc=%d from send(). errno=%d\n",n,errno); ? ? ? ? ? ??
? ? else printf(" %d bytes written to socket\n",n); ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* Loop to read from the socket and display the data */ ? ? ? ? ? ? ? ??
? ? rc=close(sd); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? printf("rc=%d from close() of socket\n",rc); ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? if(rc<0) { printf("** errno=%d\n",errno); exit(1); } ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? return 0; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? } ?/* end of main */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /* ---------------------------------------------------------------- */ ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? static void crlf2nl(unsigned char *buf, int len) ? ? ? ? ? ? ? ? ? ? ? ?
? ? /* Change all Ebcdic CRLF pairs to (blank,\n) */ ? ? ? ? ? ? ? ? ? ? ? ?
? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? int i,n1; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? unsigned char ebc_crlf?2¨={0x0D,0x25}; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? unsigned char blknl?2¨={' ','\n'}; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? if(len<2) return; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? n1=len-1; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? for(i=0;i<n1;i++) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? { if(memcmp(buf+i,ebc_crlf,2)==0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? { memcpy(buf+i,blknl,2); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? i++; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? } ?/* end of crlf2nl */ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? /inc $tcp:watc.sockets.obj ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? /inc $tcp:watc.muresolv.obj ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

Joe

On Mon, Jun 21, 2021 at 2:50 PM Tom Chandler <tchandler48@...> wrote:
/com ** Sample Waterloo C sockets program.
/com ** See the comment about DNS servers below.
/com ** Tests functions: connect(), send(), recv(), muresolve(),
/com ** ? musa2e(), muse2a()
/inc watc
#include <stdio.h>
#include <string.h> ? /* for memset(), etc. */
#include <stdlib.h> ? /* for exit() */
#include <errno.h> ? ?/* for access to errno */

/* prototype for local function */
static void crlf2nl(unsigned char *buf, int len);

int main(void)
{
int i,n,rc,wlen;
int sd; ? ?/* socket descriptor */
unsigned long ipaddr; ?/* 32-bit IP address */
unsigned char *sitename=""; ?/* site to connect to */
unsigned char *ipnum="132.206.120.4"; ?/* numeric IP addr to use
? ? ? ? ? ? ? ? ? ? if sitename cannot be resolved by DNS */
int port=80; ? ?/* port number to connect to */
struct sockaddr_in saddr;
int numreads,totbytes;
unsigned char *wrdata= \
? ? "GET /msi/http/music.html HTTP/1.0\r\x25\r\x25";
? ? ? ?/* HTML request, to send to a web server.
? ? ? ? ? Note use of \r\x25 for CRLF. WatC Ebcdic: 0x0D 0x25.
? ? ? ? ? muse2a() and etoa() translate it to Ascii CR LF = 0x0D 0x0A.
? ? ? ?*/
unsigned char lastch,buf[400];

printf("\nWatC sockets sample program\n\n");

/* Resolve the site name to an IP address */
/* Note: The muresolve functions uses a DNS server to lookup the
? ?IP address for the given site name (domain name).? This requires
? ?that you have 1 or more DNS server IP addresses defined in
? ?your $tcp:tcpip.config file, as NAMESERV records.
? ?Normally the DNS (Domain Name System) server IP addresses are
? ?provided by your ISP (Internet Service Provider).
? ?If you don't have any DNS servers, you can add the following
? ?record to file $tcp:ip.alias : ? 132.206.120.4
? ?Or, in this source file, set: ?sitename="132.206.120.4"
*/

rc = muresolve(sitename,&ipaddr);
if(rc < 0)
? {
? ? ? ? ? printf("** Error: unable to resolve site name %s\n"
? ? ? ? ? ?" ? ? muresolve() gave rc=%d\n",sitename,rc);
? ? ? printf("** Using a specific numeric IP address instead: %s\n",
? ? ? ? ? ?ipnum);
? ? ?ipaddr=inet_addr(ipnum);
? }

sd = socket(AF_INET,SOCK_STREAM,0);
printf("sd = %d from socket() create\n",sd);
if(sd < 0)
? ? ? ?{
? ? ? ? ? printf("** errno=%d\n",errno); exit(1);
? ? ? ?}

/* Set up the socket address structure for connect() */
memset(&saddr,0,sizeof(saddr)); ?/* init. it to 0 */
saddr.sin_family=AF_INET;
saddr.sin_port=htons((unsigned short)port);
saddr.sin_addr.s_addr=ipaddr;

printf("Connecting to %s %s port %d\n",sitename, \
? ? ? ?inet_ntoa(saddr.sin_addr),port);

rc = connect(sd,(struct sockaddr *)&saddr,sizeof(saddr));
printf("rc=%d from connect()\n",rc);

if(rc<0)
? { printf("** errno=%d\n",errno);
? ? if(errno==ECONNREFUSED)
? ? ? ? printf(" ? ?ECONNREFUSED - Connection refused\n");
? ? if(errno==EHOSTUNREACH)
? ? ? ? printf(" ? ?EHOSTUNREACH - Host unreachable\n");
? ? exit(1);
? }

/* Write data to the socket */
wlen=strlen(wrdata);
printf("# of bytes to be written: wlen=%d\ndata=|%s|\n",wlen,wrdata);
muse2a(wrdata,wlen); ?/* convert from Ebcdic to Ascii! */
n=send(sd,wrdata,wlen,0);
if(n<0) printf("** rc=%d from send(). errno=%d\n",n,errno);
else printf(" %d bytes written to socket\n",n);

/* Loop to read from the socket and display the data */
printf("Reading from socket...\n");
for(numreads=0,totbytes=0,lastch=0;;)
? { numreads++;
? ? n=recv(sd,buf,sizeof(buf),0);
? ? if(n<0) { printf("** rc=%d from recv(). errno=%d\n",n,errno);
? ? ? ? ? ? ? break; }
? ? if(n==0) break; ?/* end of data, server shutdown socket */
? ? totbytes+=n;
? ? musa2e(buf,n); ?/* convert from Ascii to Ebcdic! */
? ? crlf2nl(buf,n); ?/* then change all CRLF to (blank,\n) */
? ? ? ? /* Fix for case of CRLF split between buffers: */
? ? ? ? if(lastch==0x0D && buf[0]==0x25) buf[0]='\n';
? ? ? ? lastch=buf[n-1];
? ? ? ? if(lastch==0x0D) buf[n-1]=' ';
? ? for(i=0;i<n;i++) putc(buf[i],stdout);
? }
printf(" numreads=%d totbytes=%d\n",numreads,totbytes);

rc=close(sd);
printf("rc=%d from close() of socket\n",rc);
if(rc<0) { printf("** errno=%d\n",errno); exit(1); }

return 0;
} ? /* end of main */

/* ---------------------------------------------------------------- */

static void crlf2nl(unsigned char *buf, int len)
/* Change all Ebcdic CRLF pairs to (blank,\n) */
{
int i,n1;
unsigned char ebc_crlf[2]={0x0D,0x25};
unsigned char blknl[2]={' ','\n'};

if(len<2) return;
n1=len-1;
for(i=0;i<n1;i++)
? { if(memcmp(buf+i,ebc_crlf,2)==0)
? ? ? { memcpy(buf+i,blknl,2);
? ? ? ? i++;
? ? ? }
? }
} ?/* end of crlf2nl */



Virus-free.

On Mon, Jun 21, 2021 at 12:48 PM Joe Monk <joemonk64@...> wrote:
Ok do me a favor ... copy/paste the sample program in a reply to this email.

joe

On Mon, Jun 21, 2021 at 12:24 PM Tom Chandler <tchandler48@...> wrote:
tried the sample program int the dir $TCP and it will not work also.

Cheers
tom c


Virus-free.

On Mon, Jun 21, 2021 at 12:12 PM Joe Monk <joemonk64@...> wrote:
Ok first ... remember the manuals were written for Music 5.1. You are running Music/SP 6.2.

Look at the sample program. It should show everything you need.

Joe

On Mon, Jun 21, 2021 at 11:24 AM Tom Chandler <tchandler48@...> wrote:
I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.

On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 

/com ** Sample Waterloo C sockets program.
/com ** See the comment about DNS servers below.
/com ** Tests functions: connect(), send(), recv(), muresolve(),
/com ** ? musa2e(), muse2a()
/inc watc
#include <stdio.h>
#include <string.h> ? /* for memset(), etc. */
#include <stdlib.h> ? /* for exit() */
#include <errno.h> ? ?/* for access to errno */

/* prototype for local function */
static void crlf2nl(unsigned char *buf, int len);

int main(void)
{
int i,n,rc,wlen;
int sd; ? ?/* socket descriptor */
unsigned long ipaddr; ?/* 32-bit IP address */
unsigned char *sitename=""; ?/* site to connect to */
unsigned char *ipnum="132.206.120.4"; ?/* numeric IP addr to use
? ? ? ? ? ? ? ? ? ? if sitename cannot be resolved by DNS */
int port=80; ? ?/* port number to connect to */
struct sockaddr_in saddr;
int numreads,totbytes;
unsigned char *wrdata= \
? ? "GET /msi/http/music.html HTTP/1.0\r\x25\r\x25";
? ? ? ?/* HTML request, to send to a web server.
? ? ? ? ? Note use of \r\x25 for CRLF. WatC Ebcdic: 0x0D 0x25.
? ? ? ? ? muse2a() and etoa() translate it to Ascii CR LF = 0x0D 0x0A.
? ? ? ?*/
unsigned char lastch,buf[400];

printf("\nWatC sockets sample program\n\n");

/* Resolve the site name to an IP address */
/* Note: The muresolve functions uses a DNS server to lookup the
? ?IP address for the given site name (domain name).? This requires
? ?that you have 1 or more DNS server IP addresses defined in
? ?your $tcp:tcpip.config file, as NAMESERV records.
? ?Normally the DNS (Domain Name System) server IP addresses are
? ?provided by your ISP (Internet Service Provider).
? ?If you don't have any DNS servers, you can add the following
? ?record to file $tcp:ip.alias : ? 132.206.120.4
? ?Or, in this source file, set: ?sitename="132.206.120.4"
*/

rc = muresolve(sitename,&ipaddr);
if(rc < 0)
? {
? ? ? ? ? printf("** Error: unable to resolve site name %s\n"
? ? ? ? ? ?" ? ? muresolve() gave rc=%d\n",sitename,rc);
? ? ? printf("** Using a specific numeric IP address instead: %s\n",
? ? ? ? ? ?ipnum);
? ? ?ipaddr=inet_addr(ipnum);
? }

sd = socket(AF_INET,SOCK_STREAM,0);
printf("sd = %d from socket() create\n",sd);
if(sd < 0)
? ? ? ?{
? ? ? ? ? printf("** errno=%d\n",errno); exit(1);
? ? ? ?}

/* Set up the socket address structure for connect() */
memset(&saddr,0,sizeof(saddr)); ?/* init. it to 0 */
saddr.sin_family=AF_INET;
saddr.sin_port=htons((unsigned short)port);
saddr.sin_addr.s_addr=ipaddr;

printf("Connecting to %s %s port %d\n",sitename, \
? ? ? ?inet_ntoa(saddr.sin_addr),port);

rc = connect(sd,(struct sockaddr *)&saddr,sizeof(saddr));
printf("rc=%d from connect()\n",rc);

if(rc<0)
? { printf("** errno=%d\n",errno);
? ? if(errno==ECONNREFUSED)
? ? ? ? printf(" ? ?ECONNREFUSED - Connection refused\n");
? ? if(errno==EHOSTUNREACH)
? ? ? ? printf(" ? ?EHOSTUNREACH - Host unreachable\n");
? ? exit(1);
? }

/* Write data to the socket */
wlen=strlen(wrdata);
printf("# of bytes to be written: wlen=%d\ndata=|%s|\n",wlen,wrdata);
muse2a(wrdata,wlen); ?/* convert from Ebcdic to Ascii! */
n=send(sd,wrdata,wlen,0);
if(n<0) printf("** rc=%d from send(). errno=%d\n",n,errno);
else printf(" %d bytes written to socket\n",n);

/* Loop to read from the socket and display the data */
printf("Reading from socket...\n");
for(numreads=0,totbytes=0,lastch=0;;)
? { numreads++;
? ? n=recv(sd,buf,sizeof(buf),0);
? ? if(n<0) { printf("** rc=%d from recv(). errno=%d\n",n,errno);
? ? ? ? ? ? ? break; }
? ? if(n==0) break; ?/* end of data, server shutdown socket */
? ? totbytes+=n;
? ? musa2e(buf,n); ?/* convert from Ascii to Ebcdic! */
? ? crlf2nl(buf,n); ?/* then change all CRLF to (blank,\n) */
? ? ? ? /* Fix for case of CRLF split between buffers: */
? ? ? ? if(lastch==0x0D && buf[0]==0x25) buf[0]='\n';
? ? ? ? lastch=buf[n-1];
? ? ? ? if(lastch==0x0D) buf[n-1]=' ';
? ? for(i=0;i<n;i++) putc(buf[i],stdout);
? }
printf(" numreads=%d totbytes=%d\n",numreads,totbytes);

rc=close(sd);
printf("rc=%d from close() of socket\n",rc);
if(rc<0) { printf("** errno=%d\n",errno); exit(1); }

return 0;
} ? /* end of main */

/* ---------------------------------------------------------------- */

static void crlf2nl(unsigned char *buf, int len)
/* Change all Ebcdic CRLF pairs to (blank,\n) */
{
int i,n1;
unsigned char ebc_crlf[2]={0x0D,0x25};
unsigned char blknl[2]={' ','\n'};

if(len<2) return;
n1=len-1;
for(i=0;i<n1;i++)
? { if(memcmp(buf+i,ebc_crlf,2)==0)
? ? ? { memcpy(buf+i,blknl,2);
? ? ? ? i++;
? ? ? }
? }
} ?/* end of crlf2nl */



Virus-free.


On Mon, Jun 21, 2021 at 12:48 PM Joe Monk <joemonk64@...> wrote:
Ok do me a favor ... copy/paste the sample program in a reply to this email.

joe

On Mon, Jun 21, 2021 at 12:24 PM Tom Chandler <tchandler48@...> wrote:
tried the sample program int the dir $TCP and it will not work also.

Cheers
tom c


Virus-free.

On Mon, Jun 21, 2021 at 12:12 PM Joe Monk <joemonk64@...> wrote:
Ok first ... remember the manuals were written for Music 5.1. You are running Music/SP 6.2.

Look at the sample program. It should show everything you need.

Joe

On Mon, Jun 21, 2021 at 11:24 AM Tom Chandler <tchandler48@...> wrote:
I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.

On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 

Ok do me a favor ... copy/paste the sample program in a reply to this email.

joe

On Mon, Jun 21, 2021 at 12:24 PM Tom Chandler <tchandler48@...> wrote:
tried the sample program int the dir $TCP and it will not work also.

Cheers
tom c


Virus-free.

On Mon, Jun 21, 2021 at 12:12 PM Joe Monk <joemonk64@...> wrote:
Ok first ... remember the manuals were written for Music 5.1. You are running Music/SP 6.2.

Look at the sample program. It should show everything you need.

Joe

On Mon, Jun 21, 2021 at 11:24 AM Tom Chandler <tchandler48@...> wrote:
I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.

On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 

tried the sample program int the dir $TCP and it will not work also.

Cheers
tom c


Virus-free.


On Mon, Jun 21, 2021 at 12:12 PM Joe Monk <joemonk64@...> wrote:
Ok first ... remember the manuals were written for Music 5.1. You are running Music/SP 6.2.

Look at the sample program. It should show everything you need.

Joe

On Mon, Jun 21, 2021 at 11:24 AM Tom Chandler <tchandler48@...> wrote:
I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.

On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 

Ok first ... remember the manuals were written for Music 5.1. You are running Music/SP 6.2.

Look at the sample program. It should show everything you need.

Joe

On Mon, Jun 21, 2021 at 11:24 AM Tom Chandler <tchandler48@...> wrote:
I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.

On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 

I will try the change, but I found this, now to figure out how,what,when....


CARGCALL



This subroutine is intended for C programmers calling TCP/IP socket

routines. When called before the first socket routine, it guarantees
that
the arguments are passed in the manner C requires.



CALLING SEQUENCE: CALL CARGCALL();
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in the help menu, system subroutines.

Still working on it.
Ok. In a FORTRAN program, you might use something like this:

/FILE SUBLIB PDS(*OS,*MUS)

I don't know if this would work in a C program or if you need something
different in that environment.

Bear in mind that the available documentation may be appropriate for
C/370 or something else that is not WATC.

Regards,
Peter Coghlan.


Re: server programming in "C"

 

I will try the change, but I found this, now to figure out how,what,when....


CARGCALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? This subroutine is intended for C programmers calling TCP/IP socket ? ? ? ?
? routines.? When called before the first socket routine, it guarantees that
? the arguments are passed in the manner C requires. ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
CALLING SEQUENCE: ?CALL CARGCALL(); ? ? ? ??
I think I am not linking to the correct MUSIC/SP library.
Got to learn more about compile time libraries.

The above was found in? the help menu, system subroutines.

Still working on it.
Cheers
Tom c
? ? ? ? ? ? ? ? ? ? ??

Virus-free.


On Mon, Jun 21, 2021 at 11:13 AM Peter Coghlan <groups@...> wrote:
>
> The change did not compile, something about a LVALUE needed.? BUT, I think
> you are on the right track.? See below from ar_pf3 manual:
>

In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.






Re: server programming in "C"

 


The change did not compile, something about a LVALUE needed. BUT, I think
you are on the right track. See below from ar_pf3 manual:
In that case, you probably need something more complex than adding an &.
Maybe something like this:

int family = AF_INET;
int type = SOCK_STREAM;
int zero = 0;

sock = socket (&family, &type, &zero);

Regards,
Peter Coghlan.


Re: server programming in "C"

 

Sir,
The change did not compile, something about a LVALUE needed.? BUT, I think you
are on the right track.? See below from ar_pf3 manual:

****
If you wish to code socket application in C, you must include a call to CARGENV (no parameters required)
in order to cause the socket routines to automatically convert the arguments passed to assembler calling
conventions. In this case, use the normal C calling conventions as defined by the SOCKET.HDR header file.
****

It appears that cargenv converts arguments from a "C" to something else.? Still digging.? WIll look at the
debugger to see what can be done.

Thank you very much for your help and interest.

Cheers
Tom c


Virus-free.


On Mon, Jun 21, 2021 at 10:40 AM Peter Coghlan <groups@...> wrote:
>
> with no change.? The program hangs on the:
> sock = socket (AF_INET, SOCK_STREAM, 0);
> code.
>

When you say hangs, do you mean hangs waiting for something or hangs stuck
in an infinte loop?

This is a complete wild guess.? Maybe CARGENV causes arguments passed by
value to socket routines to be somehow changed into arguments passed by
reference?? How about trying something like this as a test:

sock = socket (&AF_INET, &SOCK_STREAM, &0);

and see if it still hangs?

Maybe the MUSIC debugger could be used to get more details on what is
going wrong?? It might even be possible to figure out in what way the
arguments being passed to socket() from C are "wrong" which might in
turn allow a replacement for CARGENV to be written?

Regards,
Peter Coghlan.






Re: server programming in "C"

 


with no change. The program hangs on the:
sock = socket (AF_INET, SOCK_STREAM, 0);
code.
When you say hangs, do you mean hangs waiting for something or hangs stuck
in an infinte loop?

This is a complete wild guess. Maybe CARGENV causes arguments passed by
value to socket routines to be somehow changed into arguments passed by
reference? How about trying something like this as a test:

sock = socket (&AF_INET, &SOCK_STREAM, &0);

and see if it still hangs?

Maybe the MUSIC debugger could be used to get more details on what is
going wrong? It might even be possible to figure out in what way the
arguments being passed to socket() from C are "wrong" which might in
turn allow a replacement for CARGENV to be written?

Regards,
Peter Coghlan.


Re: server programming in "C"

 

Sir,
That may true, but in WATC on music/sp, it is not defined in the socket.h
file,

Cheers
Tom c


Virus-free.


On Mon, Jun 21, 2021 at 9:14 AM Joe Monk <joemonk64@...> wrote:
IP_PROTO_TCP is defined in ip.h

Joe

On Mon, Jun 21, 2021 at 9:01 AM Tom Chandler <tchandler48@...> wrote:
Sir,
Gave it a try, but it fails in the compile as IP_PROTO_TCP
reports as undefined.

Cheers
Tom c


Virus-free.

On Sun, Jun 20, 2021 at 7:22 PM Christian Robert via <christian.robert=[email protected]> wrote:
On 2021-06-20 19:00, Tom Chandler wrote:
> Thank you for your reply.? I had included the following:
>
> /inc $tcp:watc.sockets.obj
> /inc $tcp:watc.muresolv.obj
> /inc $tcp:watc.mugetsoc.obj
>
> with no change.? The program hangs on the:
> sock = socket (AF_INET, SOCK_STREAM, 0);
> code.
>
> Cheers
> Tom c.

I would use sock = socket (AF_INET, SOCK_STREAM, IP_PROTO_TCP);
or something like that.

I can't help you more because I didn't manage to make TCPIP available yet in my Hercules.
Not sure if it's possible.

Xtian.


>
>
> <>? ? ? Virus-free. <>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sun, Jun 20, 2021 at 5:08 PM Christian Robert via <> <christian.robert=[email protected] <mailto:[email protected]>> wrote:
>
>? ? ?I think that if you link your program with $TCP:WATC.SOCKETS.OBJ
>? ? ?you will not have to call anything special.
>
>? ? ?my 2 cents,
>
>? ? ?Xtian.
>
>? ? ?On 2021-06-20 15:27, Tom Chandler wrote:
>? ? ? > I am trying to port over a server program in "C", to MUSIC/SP using WATC?? In the AR guide, part-3
>? ? ? > page 228, the following is referenced:
>? ? ? >
>? ? ? > .If you wish to code socket application in C, you must include a call to CARGENV (no parameters required)
>? ? ? > in order to cause the socket routines to automatically convert the arguments passed to assembler calling
>? ? ? > conventions. In this case, use the normal C calling conventions as defined by the SOCKET.HDR header file.
>? ? ? >
>? ? ? > I can find NO reference anyway else about CARGENV.? and of course by server program will not work
>? ? ? > on MUSIC/SP.? Any direction or info on how to use or where to find info on CARGENV, would be
>? ? ? > very helpful.
>? ? ? >
>? ? ? > Thank You
>? ? ? > Tom c
>? ? ? >
>
>
>
>
>
>






Re: server programming in "C"

 

IP_PROTO_TCP is defined in ip.h

Joe

On Mon, Jun 21, 2021 at 9:01 AM Tom Chandler <tchandler48@...> wrote:
Sir,
Gave it a try, but it fails in the compile as IP_PROTO_TCP
reports as undefined.

Cheers
Tom c


Virus-free.

On Sun, Jun 20, 2021 at 7:22 PM Christian Robert via <christian.robert=[email protected]> wrote:
On 2021-06-20 19:00, Tom Chandler wrote:
> Thank you for your reply.? I had included the following:
>
> /inc $tcp:watc.sockets.obj
> /inc $tcp:watc.muresolv.obj
> /inc $tcp:watc.mugetsoc.obj
>
> with no change.? The program hangs on the:
> sock = socket (AF_INET, SOCK_STREAM, 0);
> code.
>
> Cheers
> Tom c.

I would use sock = socket (AF_INET, SOCK_STREAM, IP_PROTO_TCP);
or something like that.

I can't help you more because I didn't manage to make TCPIP available yet in my Hercules.
Not sure if it's possible.

Xtian.


>
>
> <>? ? ? Virus-free. <>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sun, Jun 20, 2021 at 5:08 PM Christian Robert via <> <christian.robert=[email protected] <mailto:[email protected]>> wrote:
>
>? ? ?I think that if you link your program with $TCP:WATC.SOCKETS.OBJ
>? ? ?you will not have to call anything special.
>
>? ? ?my 2 cents,
>
>? ? ?Xtian.
>
>? ? ?On 2021-06-20 15:27, Tom Chandler wrote:
>? ? ? > I am trying to port over a server program in "C", to MUSIC/SP using WATC?? In the AR guide, part-3
>? ? ? > page 228, the following is referenced:
>? ? ? >
>? ? ? > .If you wish to code socket application in C, you must include a call to CARGENV (no parameters required)
>? ? ? > in order to cause the socket routines to automatically convert the arguments passed to assembler calling
>? ? ? > conventions. In this case, use the normal C calling conventions as defined by the SOCKET.HDR header file.
>? ? ? >
>? ? ? > I can find NO reference anyway else about CARGENV.? and of course by server program will not work
>? ? ? > on MUSIC/SP.? Any direction or info on how to use or where to find info on CARGENV, would be
>? ? ? > very helpful.
>? ? ? >
>? ? ? > Thank You
>? ? ? > Tom c
>? ? ? >
>
>
>
>
>
>






Re: server programming in "C"

 

Sir,
Gave it a try, but it fails in the compile as IP_PROTO_TCP
reports as undefined.

Cheers
Tom c


Virus-free.

On Sun, Jun 20, 2021 at 7:22 PM Christian Robert via <christian.robert=[email protected]> wrote:

On 2021-06-20 19:00, Tom Chandler wrote:
> Thank you for your reply.? I had included the following:
>
> /inc $tcp:watc.sockets.obj
> /inc $tcp:watc.muresolv.obj
> /inc $tcp:watc.mugetsoc.obj
>
> with no change.? The program hangs on the:
> sock = socket (AF_INET, SOCK_STREAM, 0);
> code.
>
> Cheers
> Tom c.

I would use sock = socket (AF_INET, SOCK_STREAM, IP_PROTO_TCP);
or something like that.

I can't help you more because I didn't manage to make TCPIP available yet in my Hercules.
Not sure if it's possible.

Xtian.


>
>
> <>? ? ? Virus-free. <>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sun, Jun 20, 2021 at 5:08 PM Christian Robert via <> <christian.robert=[email protected] <mailto:[email protected]>> wrote:
>
>? ? ?I think that if you link your program with $TCP:WATC.SOCKETS.OBJ
>? ? ?you will not have to call anything special.
>
>? ? ?my 2 cents,
>
>? ? ?Xtian.
>
>? ? ?On 2021-06-20 15:27, Tom Chandler wrote:
>? ? ? > I am trying to port over a server program in "C", to MUSIC/SP using WATC?? In the AR guide, part-3
>? ? ? > page 228, the following is referenced:
>? ? ? >
>? ? ? > .If you wish to code socket application in C, you must include a call to CARGENV (no parameters required)
>? ? ? > in order to cause the socket routines to automatically convert the arguments passed to assembler calling
>? ? ? > conventions. In this case, use the normal C calling conventions as defined by the SOCKET.HDR header file.
>? ? ? >
>? ? ? > I can find NO reference anyway else about CARGENV.? and of course by server program will not work
>? ? ? > on MUSIC/SP.? Any direction or info on how to use or where to find info on CARGENV, would be
>? ? ? > very helpful.
>? ? ? >
>? ? ? > Thank You
>? ? ? > Tom c
>? ? ? >
>
>
>
>
>
>






Re: server programming in "C"

 

Sir,
for testing, I run a sim390 and a Hercules version.? The Hercules is SPINHAWK, using
the modifications by Peter Coghlan.? It allows MUSIC/SP tcpip access while running
under Hercules.? The ftp & http server work great.? Have been using it for over a year now.

The reason I usd sim390 and Hercules is to help validate Peter's modification are
working as expected.

Cheers
Tom? c.

Virus-free.

On Sun, Jun 20, 2021 at 7:29 PM Joe Monk <joemonk64@...> wrote:
The reason I ask is this, from the readme.txt in the musdemo_b download:

"You can also run the MUSIC/SP Demo system under the Hercules mainframe
emulator, but in that case none of the tcp/ip applications in MUSIC/SP
can be used, such as FTP, FTPD, HTTPD, socket programming, etc."

Joe

On Sun, Jun 20, 2021 at 7:27 PM Joe Monk via <joemonk64=[email protected]> wrote:
Are you running under hercules or Sim390?

Joe

On Sun, Jun 20, 2021 at 6:00 PM Tom Chandler <tchandler48@...> wrote:
Thank you for your reply.? I had included the following:

/inc $tcp:watc.sockets.obj
/inc $tcp:watc.muresolv.obj
/inc $tcp:watc.mugetsoc.obj

with no change.? The program hangs on the:
sock = socket (AF_INET, SOCK_STREAM, 0);
code.

Cheers
Tom c.


Virus-free.

On Sun, Jun 20, 2021 at 5:08 PM Christian Robert via <christian.robert=[email protected]> wrote:
I think that if you link your program with $TCP:WATC.SOCKETS.OBJ
you will not have to call anything special.

my 2 cents,

Xtian.

On 2021-06-20 15:27, Tom Chandler wrote:
> I am trying to port over a server program in "C", to MUSIC/SP using WATC?? In the AR guide, part-3
> page 228, the following is referenced:
>
> .If you wish to code socket application in C, you must include a call to CARGENV (no parameters required)
> in order to cause the socket routines to automatically convert the arguments passed to assembler calling
> conventions. In this case, use the normal C calling conventions as defined by the SOCKET.HDR header file.
>
> I can find NO reference anyway else about CARGENV.? and of course by server program will not work
> on MUSIC/SP.? Any direction or info on how to use or where to find info on CARGENV, would be
> very helpful.
>
> Thank You
> Tom c
>