Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: UDPServerUDPRead Can not view image...


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jun 20, 2017 12:16 PM Last Post By: James L Threads: [ Previous | Next ]
James L

Posts: 13
Registered: 8/3/03
UDPServerUDPRead Can not view image...  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 19, 2017 3:53 PM
UDPServerUDPRead Can not view image...

Hello,

My Code like below, receive image file, but can not view image immediately.

void __fastcall TCameraComponentForm::UDPServerUDPRead(TIdUDPListenerThread *AThread,
const TIdBytes AData, TIdSocketHandle *ABinding)
{
TBytesStream *bmpStream;
bmpStream = new TBytesStream(AData);

try
{
Image3->Bitmap->LoadFromStream(bmpStream);
Image3->Repaint();
}
__finally
{
delete bmpStream;
}
}

Thank for any help and suggestions

James
Remy Lebeau (Te...


Posts: 8,950
Registered: 12/23/01
Re: UDPServerUDPRead Can not view image...
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 19, 2017 7:49 PM   in response to: James L in response to: James L
James L wrote:

UDPServerUDPRead Can not view image...

You are not providing any useful information to diagnose your problem
with.

Is the TIdUDPServer::ThreadedEvent property set to false? TIdUDPServer
is a multi-threaded component. If ThreadedEvent is false, OnUDPRead is
fired in the context of the main UI thread, otherwise it is fired in a
worker thread. Since you are accessing a UI control, make sure
ThreadedEvent is false.

Did you validate that the received bytes are a valid and correct BMP
image? Are you getting an exception when loading the bytes into the
TImage? If you save the bytes as-is to a temp .bmp file, can you view
the bitmap in Windows Explorer, or any graphics program?

Why are you sending bitmap images over UDP to begin with? Where are
the images coming from? Are you sending them yourself, or else someone
else? If you, what does your sending code look like?

--
Remy Lebeau (TeamB)
James L

Posts: 13
Registered: 8/3/03
Re: UDPServerUDPRead Can not view image...  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 20, 2017 12:16 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Did you validate that the received bytes are a valid and correct BMP
image? Are you getting an exception when loading the bytes into the
TImage? If you save the bytes as-is to a temp .bmp file, can you view
the bitmap in Windows Explorer, or any graphics program?
Remy Lebeau (TeamB)

I try save bmp file and debug, It's work now, thank you,
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02