Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
120 user(s) are online (61 user(s) are browsing Forums)

Members: 0
Guests: 120

more...

Headlines

 
  Register To Post  

CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
This was the simplest client/server node I could come up with:

CSNode on github.com

Feel free to rave in antigony or otherwise celebrate. I apologize in advance.

I love this place. Should you in any way be doubtful about it.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just popping in
Just popping in


See User information
@alfkil

Unfortunately the link gives a 404 error.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
@Steady

Oops! I must have made it private. It has now been fixed.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Site Builder
Site Builder


See User information
@alfkill
That's awesome. but... what does it do? :D :D :D

It is example code on how to create a server and client talk to each other?
You use sockets to communicate?
What are the plans for the future of it?

If it is example code on how things are working, I'd love some more info on parts of code, and also, an equivalent C code, if possible.

Follow me on
Ko-fi, Twitter, YouTube, Twitch
Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
@walkero

I was frustrated with different ftp softwares and decideret to design the simpleste software, that would handle my needs. So basically communication and file transfer over sockets. The result could potentially be useful if polished and expanded slightly.

EDIT : Of course it builds on both AmigaOS 4 and linux.


Edited by alfkil on 2021/8/5 9:37:37
Edited by alfkil on 2021/8/5 11:19:07
Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
Committed a slight improvement in Buffer.cpp and CSNode.cpp that handles file transfers better. In short it does transfer in actual bytes instead of translation over numbers/ascii. This of course minimizes number of bytes transfered and is also slightly more satisfying to look at from an engineering perspective.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
CSNode now has a very effective PUSHDIR command. It has a quite clear hitrate, and it is very satisfying to work with.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
After having done long term testing on CSNode for some days, I have come up with a test, that shows something fishy about newlib select().

To cut it short : select() will return 0 (zero) after some time of running the test, and this will be not caused by a timeout but by something else.

Posix tells, that select() returns 0 on timeout, a positive number on successfull selection on the file descriptors given as input. It returns -1 in case of an error.

In this case, something has gone wrong, since after abandonning reception of data and re-binding the host socket, the client process (another computer) is unable to call the host (the Amiga) over the network.

Also it is noticable, that select() returns zero endlessly when this state is reached. The only way out of the loop is through a count and break;

Can this behavior somehow be explained??! I know this is not very core, and the obvious answer would be to suggest switching to bsd-sockets. But there is a possible solution hidden here, I feel.

Here is the code for the testing loop:

try {
     while (
bytesReceived size && bytesReceived == bytesWritten) {
         
int i;
         for(
05i++) {
             if(
0printf(",-");
             
fd_set rfds;
             
struct timeval tv;
             
tv.tv_sec 5;
             
tv.tv_usec 0;
             
FD_ZERO(&rfds);
             
FD_SET(connection->connectionSocket, &rfds);
             
int ret select(connection->connectionSocket+1, &rfds00, &tv);
             if(
ret == 0printf("select returned zero.\n");
             if(
ret 0) {
                 throw(
1);
             }
             if(
FD_ISSET(connection->connectionSocket, &rfds)) {
                 
int bytes 0;
                 while (
bytes == 0)
                     
bytes recv(connection->connectionSocketbufferMIN(bufSizesize-bytesReceived), 0);
                 if (
bytes 0) {
                     if(
errno == ECONNRESET) {
                         
connection->isValid false;
                     }
                     throw(
0);
                 }
                 
bytesReceived += bytes;
                 
//first fill the buffer (in case it was already non-empty)
                 
connection->readBuffer.fill(bufferbytes);
                 
//...then extract from it
                 
int bytes1bytes2;
                 while((
bytes1 connection->readBuffer.readBytes(bufferMIN(bufSizesize bytesWritten))) > 0) {
                     
bytes2 write(fdbufferbytes1);
                     
bytesWritten += bytes2;
                 }
                 break;
             }
         }
         if(
== 5) throw(2);
         
cout << ".";
     }
     
cout << "ok.\n";
} catch(
int kind) {
     if(
kind == 1perror("select");
     else if(
kind == 0perror("recv");
     else 
printf("Trials max reached. Abandonning recv.\n");
}


EDIT: A partial explanation would be, that this is some kind of limitation on the local network. The test runs both computers in a loop sending the same 30mb file from the PC to the Amiga. At intervals of minutes the communication will break off and come to a standstill. Now, after a timeout on the PC side, it will tell you, that it cannot find the Amiga host (no route to host). The cute thing is, that when I ping google.com on the Amiga side, the two computers - host and client - will find each other again and recommence where they left. Explain!


Edited by alfkil on 2021/9/18 15:37:12
Go to top
Re: CSNode - file transfer over socket made as simple as possible
Amigans Defender
Amigans Defender


See User information
@alfkil

Are either of them on wi-fi? I've had weird effects with all sorts of different computers with communication randomly not working on wi-fi, although I think pings are failing then too.

Go to top
Re: CSNode - file transfer over socket made as simple as possible
Just can't stay away
Just can't stay away


See User information
@Chris

The PC is on wifi. I think something like this came up ages ago and someone told me, that it was normal behavior. Anyways, CSNode seems to be almost rock stable now and can transfer several Gigs with no failure before this happens.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project