how to use timeseal code(zseal) at FICS in an app that needs built in timeseal

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

how to use timeseal code(zseal) at FICS in an app that needs built in timeseal

Post by adams161 »

hi,

I found this for timeseal. https://github.com/fbergo/zseal

I want to do 3 things. One is do whatever it takes to properly initalize it, two is receive data and three is send data.

I can make it connect if i ignore this code in main()
if (n==0) {
fprintf(stderr,"EOF from stdin\n");
exit(0);
}
if i capture whats coming into this function i can print whats coming in in the socket in the apps console and see i'm connecting:
static void zwrite(int fd,const char *buffer,int n) {
if (write(fd,buffer,n)==-1) zdie(1);
}
i can send data with zsend but zsend calls zwrite and i cant figure out why sending and receiving is mixed. i have to hack the code a bit to get it work becasue i got write now writing to console
static void zsend(int fd, char *buffer, int *rd)
I have no idea what this function is doing but i think its needed to intialize.
static void zid(char *dest, int sz) {
char user[32], uname[128], tmp[512];
FILE *f;
struct passwd *pw;

memset(user,0,32);
memset(uname,0,128);

pw = getpwuid(geteuid());
if (pw != NULL) strncpy(user,pw->pw_name,31);

f = popen("uname -a 2>&1","r");
if (f!=NULL) {
memset(tmp,0,512);
if (fgets(tmp, 511, f)!=NULL) {
zchomp(tmp);
strncpy(uname,tmp,127);
}
pclose(f);
}

zclean(user);
zclean(uname);

memset(dest,0,sz);
snprintf(dest,sz-1,"%s (zseal %s)|%s",user, VERSION, uname);
}
Also i cant find on project page what this "popen("uname -a 2>&1","r");" -- uname file is.

End result, if i hack away at it i can connect, send and receivec but it still says timseal off.

On ios you cant run another process so i need to integrate this code into my app vs simply run a unix executable or I cant have timeseal on ios.

Mike
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: how to use timeseal code(zseal) at FICS in an app that needs built in timeseal

Post by hgm »

You could also look here: http://uz.sns.it/~m2/openseal.c

I am sure that one works fine. The one you mention seems to use the local array 'hello' uninitialized?
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: how to use timeseal code(zseal) at FICS in an app that needs built in timeseal

Post by adams161 »

hgm wrote: Fri Mar 06, 2020 10:00 am You could also look here: http://uz.sns.it/~m2/openseal.c

I am sure that one works fine. The one you mention seems to use the local array 'hello' uninitialized?
thanks. I'll look at this over the weekend. I took a quick look and it was re-assuring to see function names like SendToFics.

Mike
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: how to use timeseal code(zseal) at FICS in an app that needs built in timeseal

Post by adams161 »

adams161 wrote: Fri Mar 06, 2020 10:04 am
hgm wrote: Fri Mar 06, 2020 10:00 am You could also look here: http://uz.sns.it/~m2/openseal.c

I am sure that one works fine. The one you mention seems to use the local array 'hello' uninitialized?
thanks. I'll look at this over the weekend. I took a quick look and it was re-assuring to see function names like SendToFics.

Mike
Spent the day at it and got OpenSeal basically working. Still some bugs to work out on re-connect, particularly between servers, and when users type exit or quit and reconnect. But should be able to sort it out and release after adequate testing. I"m running it now on my iPad in the test build.

thanks again,
Mike