Code Monkey home page Code Monkey logo

Comments (7)

sblendorio avatar sblendorio commented on May 27, 2024

The main issue is how to manage a "huge" mass of data, related to a Commodore 64. It's possible to paginate by number of bytes, but not by lines.
Maybe we can read chunks of byte 'till is reached a given number of "CR" occurrences.

from ultimateii-dos-lib.

sblendorio avatar sblendorio commented on May 27, 2024

Tried with this trivial code to make a "GET HTTP/1.1", but I got no result (just "-1" as data count): what do I do wrong?

void main(void) 
{
	char buff[400];
	int i;
	uii_identify();
	uii_getipaddress();
	uii_settarget(TARGET_NETWORK);
	uii_tcpconnect("cbbsoutpost.servebbs.com", 80);
	socketnr = uii_data[0];
	printf("FASE 1-----------------\n");
	strcpy(buff,"GET /api/exportbbslist/service.php?f=csv HTTP/1.1\n\n");
	uii_tcpsocketwrite(socketnr, buff);

	printf("FASE 2-----------------\n");
	for (i=0; i<50; ++i) {
		uii_tcpsocketread(socketnr, 892);
		datacount = uii_data[0] | (uii_data[1]<<8);
		printf("%d ",datacount);
		if(datacount > 0)
			printf("%s",uii_data+2);
	}
}

from ultimateii-dos-lib.

sblendorio avatar sblendorio commented on May 27, 2024

Tried also:

strcpy(buff,"get /API/EXPORTBBSLIST/SERVICE.PHP?F=CSV http/1.1\n\n");

...but I get the same result (=no result)

from ultimateii-dos-lib.

xlar54 avatar xlar54 commented on May 27, 2024

Try changing to 1.0:

GET /api/exportbbslist/service.php?f=csv HTTP/1.0\n\n

works via telnet client for me. I think something about 1.1 has an additional requirement.

from ultimateii-dos-lib.

sblendorio avatar sblendorio commented on May 27, 2024

just tried this, I added an "experiment" folder:
https://github.com/xlar54/ultimateii-dos-lib/tree/download_with_punter_protocol/experiments
try compiling it with:

cl65 -O ultimate_ii.c net.c -o net.prg

and launch net.prg on the C64/1541u2+
It do not print anything: why?

from ultimateii-dos-lib.

xlar54 avatar xlar54 commented on May 27, 2024

fixed in recent check in

from ultimateii-dos-lib.

sblendorio avatar sblendorio commented on May 27, 2024

I have extended Ultimate_II APIs with a BufferedReader of the TCP Socket, with this extension I implemented a POC of this issue's subject with a few, clean code:
https://github.com/xlar54/ultimateii-dos-lib/blob/download_with_punter_protocol/sandbox/net.c

    uii_tcpsocketwrite_ascii(socket, "GET /api/exportbbslist/service.php?f=csv HTTP/1.0\n\n");

    // Skip HTTP header
    while (uii_tcp_nextline_ascii(socket, buff) && *buff);

    //Skip first line (header)
    uii_tcp_nextline_ascii(socket, buff);

    // Read single lines
    while (uii_tcp_nextline_ascii(socket, buff) && *buff) {
        p1 = strchr(buff+1, ',');
        p2 = strchr(p1+1, ',');
        p3 = strchr(p2+1, ',');

        strncpy(name, buff+1, (p1-buff));
        name[p1-buff-2]=0;

        strncpy(host, p1+2, (p2-p1)-2);
        host[p2-p1-3]=0;

        strncpy(port, p2+2, (p3-p2)-2);
        port[p3-p2-3]=0;

        printf("%s:%s\n", host, port);
    }
    uii_tcpclose(socket);

You can run "net.prg" on the C64 and have listed all BBSes registered on the site. The main problem I see is the slowness, despite the reading is actually buffered, 892 bytes at a time.

from ultimateii-dos-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.