DataToSend Property

A string of data to be sent to the remote host. Write-only property.

Syntax

ANSI (Cross Platform)
int SetDataToSend(const char* lpDataToSend, int lenDataToSend);

Unicode (Windows)
INT SetDataToSend(LPCSTR lpDataToSend, INT lenDataToSend);
@property (nonatomic,readwrite,assign,getter=dataToSend,setter=setDataToSend:) NSString* dataToSend;
- (NSString*)dataToSend;
- (void)setDataToSend:(NSString*)newDataToSend;

@property (nonatomic,readwrite,assign,getter=dataToSendB,setter=setDataToSendB:) NSData* dataToSendB; - (NSData*)dataToSendB; - (void)setDataToSendB:(NSData*)newDataToSend;
#define PID_UDPPORT_DATATOSEND 3


IPWORKS_EXTERNAL int IPWORKS_CALL IPWorks_UDPPort_Set(void *lpObj, int propid, int arridx, const void *val, int cbVal);

Default Value

""

Remarks

Assigning a string to the DataToSend property makes the class send the string to the remote host. The Send method provides similar functionality.

Attempts to send the string assigned to DataToSend as a complete message. If system buffers are full, or the message cannot be delivered for any other reason, an error is fired, and no portion of the message is sent. This is different from TCP where portions of the messages can be sent. UDP sends either a complete message or nothing at all.

If you are sending data to the remote host faster than it can process it, or faster than the network's bandwidth allows, the outgoing queue might fill up. When this happens, DataToSend fails with error 10035: "[10035] Operation would block" (WSAEWOULDBLOCK). You can check this error, and then try to send the data again.

Example (Send Data)


UDPPortControl.LocalPort = 8765 
UDPPortControl.RemotePort = 8765 
UDPPortControl.RemoteHost = "HostNameOrIPAddress"
UDPPortControl.Active = True
UDPPortControl.DataToSend = "Hello!"

This property is write-only and not available at design time.

Data Type

Binary String

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 C++ Edition - Version 20.0 [Build 8307]