|
Hi,
When you want send and receive data from multiple sockets just using threading concept to connect socket when send data then you make thread sleep for receiving data. then make thread sleep for sending data.
|
|
|
|
|
You are making a common mistake in assuming that the 4 bytes you want for your header information will always be received together. This will be the case 99% of the time, but it's not guaranteed, and on a busy stream you may well get partial messages, which will send your whole receive logic out of line (i.e. if the calls to socket.Receive only get 3 bytes).
Receive will block until the data is available. Are you sure your server is actually sending (8+arrayLength) bytes?
I recommend you build your solution on top of an existing message-based TCP protocol like the one in my article[^], if you need the two way connectivity and don't feel like configuring WCF to do what you want. I think I saw another article that does something similar but allows you to send complex types, but I don't have a link to that handy.
|
|
|
|
|
I solved my problem, thanks for you replies.
"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
|
|
|
|
|
Hi,
I am brand new to printing to a thermal printer using c# asp.net, and i need your help guys to give me where can i find tutorial
how can i connect and print to thermal printer using c#.
i am using VS 2008 PRO .NET 3.5
please help me to get started with thermal printing using c#
I am stuck here.
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
If the printer supports IP/network(and it should) then I don't see the problem.
Simply send the byte[] to the printer's IP.(yeah a static IP is needed for this).
Usually the industrial/thermal printers come with a predefined header/logo file.
All you need to do is send it plus the other label info.
I/we can't possibly know how to help you on a specific printer label type.
All the best,
Dan
|
|
|
|
|
thnx dan,
i already tried that way.but of no use.
I want to print in the Bill/Invoice format. Can you help me about this?
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Sorry but I don't think I can help because:
- I don't know the format of the label
- I don't know the type and protocol of the printer
Here's how I did/do it(regardless of winapp/webapp):
- Read the printer label format in a byte[] from a stream.
- Add the actual label(s) info such as PN, Qty, Batch ... according to the label specs
- Send the resulting byte[] to the printer IP
Even when using serial Connection from windows app I use the same technique(send the file/byte to the serial port).
Other possiblities:
- Use a printServer and add the thermal printer to the print server.(never did it)
- Connect the printer to USB.(only did it on win app)
All the best,
Dan
|
|
|
|
|
Thanx Don,
It will definitely help me..
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Hi,
I have been trying to use either json or xml.
My program will request the server for some details.
The response will either be json or xml according to the simplicity of either of it.
I am using plain xml and no schema or cdata and so on...
Just simple...
I want a simple parser like php's simple dom parser...
or any other alternatives would be nice...
suggestions ???
|
|
|
|
|
XmlReader[^] perhaps?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I want to remote server and client with connection.What should I do?
|
|
|
|
|
I want a nap. What should I do?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Have one!
|
|
|
|
|
I want a stiff drink today, but it's only 9:15am. A couple of those and I'll be taking the nap for you.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Learn about the different types of remoting: sockets, WCF etc. A few minutes with Google will lead you to the answers.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Richard MacCutchan wrote: A few minutes with Google will lead you to the answers.
Meh, he won't be able to make a decision with that.
So, please point him to the decision making engine.
All the best,
Dan
|
|
|
|
|
Hi,
I am having visual studio 2005 .net version 2.0
I want to use json.
I want to convert a json string to an object
how to do that?
Besides... in other new versions why it is so complicated doing that... or too many lines of code... ?
why isn't like PHP where just one function does all the magic?
http://vikku.info/ Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Did you bother to search? This article[^] was about the third hit doing a search for exactly your post title.
|
|
|
|
|
ah... the problem is i dont know c# at all.
but i know to do socket programming.
I started to learn c# by doing socket programming.
Since i had used visual basic 6.0 extensively with win32 api's it wasn't much hard to use c# but still i am not sure of some generics or what a delegate is for.
Anyway for me what i want is all this
I make a request to my server.
it will give a json string and i want to parse it and use it in my window app.
Thank you
|
|
|
|
|
As Bob Janova just kindly pointed out to you: CodeProject is your friend, and a search on JSON will lead you to many resources here.
I particularly recommend you look at Mehdi Gholam's brilliant JSON article: "fastJSON"[^], which is being frequently updated and improved.
best, Bill
"Anyone who shows me my 'blind spots' gives me the gift of sight." ... a thought from the shallows of the deeply shallow mind of ... Bill
|
|
|
|
|
Hi,
I have added one of my older project(both created in visual studio 2010 ) and now wanted to use can any one help me.
as my older dll has lot of cs files and i need to use them in my new project.
In brief older dll contains win form contents please help me!!!
|
|
|
|
|
you can use using key word to use that dll in the project.
|
|
|
|
|
It is not clear what you are asking. Do you want to use the old files in a new project? Ok, add them to the project. Do you want to use the old assembly? Add a reference to it in the new project.
No comment
|
|
|
|
|
After adding reference to the Project ,you can goto View Menu & then select the Object Browser and refer which DLL you included as Reference in the current project.Incase you need to use any class that are available in the DLL ,create an instance of the class in the code either by defining the namespace (eg : using {Namespace} or directly refering {Namespace}.Myclass =new {Namespace}.Myclass();
|
|
|
|
|
Can you rip all the .cs file and logic(from the form) and create a separate assembly? You can add a reference to this assembly and use it in your main project.
|
|
|
|