Hallo Ihr lieben
Ich habe da ein kleines Problem und bräuchte mal eure Hilfe!
Ich muss Dateien (> 2 GB) via Socket an einen Server senden.
Dazu gibt es auch eine kurze Beschreibung, (siehe weiter unten in Blau).
Wie muss der Client aussehen um den Anforderungen des Servers zu entsprechen?
Um es gleich vor weg zu nehmen, ich bin kein Java Experte, ich programmiere
eigentlich in Pascal. Allerdings muss ich dieses Projekt leider in Java machen.
Wenn mir jemand ein kleines Beispiel geben könnte, wäre ich dankbar.
Ich habe einige Beispiele hier aus dem Forum getestet, da wir die Datei
allerdings in einem Rutsch als Stream gesendet, das Funktioniert sogar.
Allerdings bekomme ich da die Antworten vom Server nicht mit, da ja laut Protokoll Blockweise
gesendet werden soll, und nach dem ersten Block kommt ja bereits eine Antwort vom Server.
Vorab vielen Dank für´s Lesen!
Gruß Baba
Socket Communication Protocol
Messages sequence
Once the client initiates connection with the Server, 5 steps can be identified:
1. The client send the job’s first block of data to Server, (size of block does not
matter).
Client (send) Server (receive) First block of job
2. The client receives back the job index message, from Server (on the same socket).
Client (receive) Server (send) Job Index
3. Client sends the rest of the job’s data (if any).
Client (send) Server (receive) Block of job... Block of job ...Block of job...
4. After Server finished receiving the job the client receive a job status message, from
Server (on the same socket). It is not mandatory to get this message, and the client
may skip this phase.
Client (receive) Server (send) Job Status
5. Client closes handle.
Note: This step is needed to enable future successful connections.
5.3 Client connection diagram
open connection
send 1st job’s block
receive job index message
send block of data
receive job status message
close handle
5.4 Messages structure
The Server returns two messages while loading jobs.
Each of these messages returned consists of 3 segments:
Message type Message length Message contents
Segment 1: a 4-byte integer representing the Message type.
Message type could be 1 of 2:
Integer value Message Type
0 Job index in Server imaging system.
1 Job status
Segment 2: a 4-byte integer representing message length, in bytes.
Segment 3: The Message itself. Its length is specified in the second segment. If the message type is
Job Index then the message is an integer representing the new job index on TS. If the message type is
job status, then the integer value could be one of:
Integer value Job‘s status
4 Job is partially loaded.
5 Job successfully loaded.
6 The user aborted job loading.
7 Job’s loading ended with errors.
Ich habe da ein kleines Problem und bräuchte mal eure Hilfe!
Ich muss Dateien (> 2 GB) via Socket an einen Server senden.
Dazu gibt es auch eine kurze Beschreibung, (siehe weiter unten in Blau).
Wie muss der Client aussehen um den Anforderungen des Servers zu entsprechen?
Um es gleich vor weg zu nehmen, ich bin kein Java Experte, ich programmiere
eigentlich in Pascal. Allerdings muss ich dieses Projekt leider in Java machen.
Wenn mir jemand ein kleines Beispiel geben könnte, wäre ich dankbar.
Ich habe einige Beispiele hier aus dem Forum getestet, da wir die Datei
allerdings in einem Rutsch als Stream gesendet, das Funktioniert sogar.
Allerdings bekomme ich da die Antworten vom Server nicht mit, da ja laut Protokoll Blockweise
gesendet werden soll, und nach dem ersten Block kommt ja bereits eine Antwort vom Server.
Vorab vielen Dank für´s Lesen!
Gruß Baba
Socket Communication Protocol
Messages sequence
Once the client initiates connection with the Server, 5 steps can be identified:
1. The client send the job’s first block of data to Server, (size of block does not
matter).
Client (send) Server (receive) First block of job
2. The client receives back the job index message, from Server (on the same socket).
Client (receive) Server (send) Job Index
3. Client sends the rest of the job’s data (if any).
Client (send) Server (receive) Block of job... Block of job ...Block of job...
4. After Server finished receiving the job the client receive a job status message, from
Server (on the same socket). It is not mandatory to get this message, and the client
may skip this phase.
Client (receive) Server (send) Job Status
5. Client closes handle.
Note: This step is needed to enable future successful connections.
5.3 Client connection diagram
open connection
send 1st job’s block
receive job index message
send block of data
receive job status message
close handle
5.4 Messages structure
The Server returns two messages while loading jobs.
Each of these messages returned consists of 3 segments:
Message type Message length Message contents
Segment 1: a 4-byte integer representing the Message type.
Message type could be 1 of 2:
Integer value Message Type
0 Job index in Server imaging system.
1 Job status
Segment 2: a 4-byte integer representing message length, in bytes.
Segment 3: The Message itself. Its length is specified in the second segment. If the message type is
Job Index then the message is an integer representing the new job index on TS. If the message type is
job status, then the integer value could be one of:
Integer value Job‘s status
4 Job is partially loaded.
5 Job successfully loaded.
6 The user aborted job loading.
7 Job’s loading ended with errors.