uced
(uced)
December 7, 2014, 7:38pm
1
Hi folks,
I would like my clients to be able to load a picture from their hard drive, and share it with other clients.
I have a function that loads an image file (jpg, png, bmp…) from disk and transform it into a UTexture2D at runtime.
It works well locally.
Now i need to send it to the server somehow.
I tried something like this:
UFUNCTION(Server, WithValidation, Reliable)
void ServerUpdateTexture(UTexture2D NewTexture);
The problem is that it will only compile when the argument is a pointer.
When i compile with a pointer, i get a crash at runtime, which seems normal: a pointer can’t be shared between different computers right ? I have to send the data somehow.
Variable replication leads to the same problem: the change has to be made on the server to trigger the replication, which means, again, sending the new texture to the server.
So how can i do this ?
Thanks
Cedric
uced
(uced)
December 14, 2014, 12:41pm
2
I tried to replicate the TArray given by the FFileHelper::LoadFileToArray function.
But i get those errors:
LogNetTraffic:Error: SerializeProperties_DynamicArray_r: ArrayNum > MAX_ARRAY_SIZE (RawFileData)
LogNet: Error: Can't send function 'ServerSetTexture' on 'BP_YagCharacter_C /Game/maps/UEDPIE_4_WelcomeMap.WelcomeMap:PersistentLevel.BP_YagCharacter_C_20': RPC bunch overflowed (too much data in parameters?)
Would it be dangerous to increase MAX_ARRAY_SIZE ? How can i do that ?
Is there a better way to transfer an image file ?
Thanks
Cedric
uced
(uced)
December 14, 2014, 5:44pm
3
I did try to recompile, changing the MAX_ARRAY_SIZE value from the original 2048 to 1048576 (to allow 1 mo pictures transfert).
The error disappeared but now i am loosing my connection.
Continuing my tries. Any suggestion to the right direction welcomed^^
LogNetPartialBunch:Warning: Channel[14] - Actor=BP_YagCharacter_C /Game/maps/UEDPIE_4_WelcomeMap.WelcomeMap:PersistentLevel.BP_YagCharacter_C_11 (Role=2 RemoteRole=3)State=open. Reliable partial bunch overflows reliable buffer!
LogNetPartialBunch:Warning: Num OutgoingBunches: 262. NumOutRec: 0
LogNetTraffic:Warning: -------------------------
LogNet: UNetConnection::Close: Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_3, PC: BP_YagPlayerController_C_5, Owner: BP_YagPlayerController_C_5, Channels: 15, RemoteAddr: 127.0.0.1:7777, Time: 2014.12.14-17.24.48
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: ControlChannel_2
LogNet: UChannel::ReceivedSequencedBunch: Bunch.bClose == true. ChIndex == 0. Calling ConditionalCleanUp.
LogNet: UChannel::CleanUp: [GameNetDriver] [BP_YagPlayerController_C_2] [BP_YagPlayerController_C_2]. ChIndex == 0. Closing connection.
LogNet: UNetConnection::Close: Name: IpConnection_5, Driver: GameNetDriver IpNetDriver_0, PC: BP_YagPlayerController_C_2, Owner: BP_YagPlayerController_C_2, Channels: 15, RemoteAddr: 127.0.0.1:59691, Time: 2014.12.14-17.24.48
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: ControlChannel_5
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet: NetworkFailure: ConnectionLost, Error: 'Your connection to the host has been lost.'
LogNet: DestroyNamedNetDriver IpNetDriver_3 [GameNetDriver]
LogExit: GameNetDriver IpNetDriver_3 shut down
uced
(uced)
January 5, 2015, 12:15pm
4
Ok, i finally solved it by using a hand crafted webserver with json requests.
Details and working code here:
Hey there, I would like my users (clients) to share pictures from their local disk. Seems like a simple problem enough, but i have been working my *** off to do that, couldn’t succeed, so here am i. I have a function that makes a UTexture2D from...
Cedric