Click here to Skip to main content
15,897,968 members
Home / Discussions / C#
   

C#

 
GeneralRe: What should be the Return Type? Pin
Rob Philpott2-Dec-11 5:50
Rob Philpott2-Dec-11 5:50 
AnswerRe: What should be the Return Type? Pin
PIEBALDconsult2-Dec-11 2:08
mvePIEBALDconsult2-Dec-11 2:08 
GeneralRe: What should be the Return Type? Pin
Eddy Vluggen2-Dec-11 7:30
professionalEddy Vluggen2-Dec-11 7:30 
QuestionComponent Versioning and the CLR Pin
Richard Andrew x641-Dec-11 16:43
professionalRichard Andrew x641-Dec-11 16:43 
AnswerRe: Component Versioning and the CLR Pin
Not Active1-Dec-11 17:18
mentorNot Active1-Dec-11 17:18 
GeneralRe: Component Versioning and the CLR Pin
Richard Andrew x641-Dec-11 17:21
professionalRichard Andrew x641-Dec-11 17:21 
GeneralRe: Component Versioning and the CLR Pin
Rob Philpott2-Dec-11 2:46
Rob Philpott2-Dec-11 2:46 
QuestionC# Sockets Pin
Sautin.net1-Dec-11 7:48
Sautin.net1-Dec-11 7:48 
K, I am relatively new to sockets so bear with me.

I have an experimental Client/Server socket application I am developing to replace an existing
legacy DCOM Client/Server architecture.

What i am trying to do is replicate the class interface of the legacy DCOM client classes in the TCP Socket client classes.

For instance
DCOM Client Call Signature:
Call on the client class to retrieve an array of information from the DCOM server.
int returnValue = client.GetArray(int arrayID, ref object values)

This client also receives updates from the server at regular intervals.

So my problem is with the new TCP Socket based class.

I have a thread within the client class that is listening for updates from the server.

Now I send a byte[] based call to the TCP server which returns a byte[] containing 2 integers and an array in this order: ResultOfCall(4 bytes) ArrayBytesLength(4 bytes) ArrayBytes(? bytes)
// send the request<br />
byte[] callSignature = GetSomeCallSignature(parameters);<br />
mySocket.Send(callSignature);<br />
<br />
// receive the function return value<br />
byte[] returnVal = new byte[4]<br />
mySocket.Receive(returnVal,4,0);<br />
int retVal = BitConverter.ToInt32(returnVal);<br />
<br />
// receive the array bytes length<br />
returnVal = new byte[4]<br />
mySocket.Receive(returnVal,4,0);<br />
int arrayLength = BitConverter.ToInt32(returnVal);<br />
<br />
// receive the array<br />
byte[] arrayBytes = new byte[arrayLength];<br />
mySocket.Receive(arrayBytes,arrayLength,0);<br />
<br />
// convert to an array from bytes<br />
object arrayValue = this.ConvertToArray(arrayBytes);


My problem is that the thread that is constantly checking for updates will read everything past the first receive(receive the function return value) and the program will lock up on the second receive
(i.e. receive the array bytes length). My question, is it only feasible to have two socket connections to the server class for each client? One for executing commands against the server and one for listening for events from the server. There really is no way to tell how many clients will be connected to the server, doesn't this open up a can of worms?
"All of us who served in one war or another know very well that all wars are the glory and the agony of the young."
Gerald Ford

AnswerRe: C# Sockets Pin
Addy Tas1-Dec-11 12:45
Addy Tas1-Dec-11 12:45 
AnswerRe: C# Sockets Pin
jschell1-Dec-11 13:39
jschell1-Dec-11 13:39 
AnswerRe: C# Sockets Pin
Jitendra Parida - Jeetu1-Dec-11 21:41
Jitendra Parida - Jeetu1-Dec-11 21:41 
AnswerRe: C# Sockets Pin
BobJanova1-Dec-11 23:52
BobJanova1-Dec-11 23:52 
AnswerRe: C# Sockets (Solved) Pin
Sautin.net2-Dec-11 9:33
Sautin.net2-Dec-11 9:33 
QuestionPrinting in C# on Thermal Printer Pin
vijay.victory1-Dec-11 6:26
vijay.victory1-Dec-11 6:26 
AnswerRe: Printing in C# on Thermal Printer Pin
Dan Mos1-Dec-11 6:43
Dan Mos1-Dec-11 6:43 
GeneralRe: Printing in C# on Thermal Printer Pin
vijay.victory1-Dec-11 7:07
vijay.victory1-Dec-11 7:07 
AnswerRe: Printing in C# on Thermal Printer Pin
Dan Mos1-Dec-11 7:19
Dan Mos1-Dec-11 7:19 
GeneralRe: Printing in C# on Thermal Printer Pin
vijay.victory1-Dec-11 7:58
vijay.victory1-Dec-11 7:58 
Questiondom xml in c# like in php simpledomparser Pin
Jayapal Chandran1-Dec-11 3:50
Jayapal Chandran1-Dec-11 3:50 
AnswerRe: dom xml in c# like in php simpledomparser Pin
Richard MacCutchan1-Dec-11 5:19
mveRichard MacCutchan1-Dec-11 5:19 
QuestionC# remoting server and client problem with connection Pin
kornkimhour1-Dec-11 3:42
kornkimhour1-Dec-11 3:42 
AnswerRe: C# remoting server and client problem with connection Pin
#realJSOP1-Dec-11 5:08
professional#realJSOP1-Dec-11 5:08 
GeneralRe: C# remoting server and client problem with connection Pin
BobJanova1-Dec-11 5:15
BobJanova1-Dec-11 5:15 
GeneralRe: C# remoting server and client problem with connection Pin
fjdiewornncalwe1-Dec-11 5:16
professionalfjdiewornncalwe1-Dec-11 5:16 
AnswerRe: C# remoting server and client problem with connection Pin
Richard MacCutchan1-Dec-11 5:18
mveRichard MacCutchan1-Dec-11 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.