|
|
|
Hi all,
Can somebody help me on how to create multiple connection to different server using ip/port at the same time and receive data.
I have a program in C# but it's only working for 1 connection. Please help me or redirect me for a tutorial on multiple socket programming in C#.
I'm new to this thing.
|
|
|
|
|
Multithreading will do the trick. Just open a each TcpListener or Socket(udp) connection in a seperate thread.
|
|
|
|
|
You've shown that you have the code to connect from one machine to another. Just duplicate it. Nothing says that you can have only one socket open at a time so it's fine to do something like this:
open Socket A
open Socket B
. . .
read something from A
. . .
write the data to B
. . .
close A
close B
you don't even need to close the sockets for each operation. You can leave them open for the lifetime of the process if you need to instead of opening them and closing them each time that you need them.
Unfortunately I don't have any links to tutorials on multiple socket programming; i doubt that any really exist. There's no real difference between using one socket and using multiple sockets except that in the former you see things like Socket and in the latter you'll see things like List ( Socket ) .
|
|
|
|
|
|
Using a COM object in PHP has nothing to do with C#, not even remotely. I dunno if PHP does COM ( I doubt it ), but the web dev forum is the one to try.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks message reposted to web development
|
|
|
|
|
I am building a udp voice chat(p2p) application in csharp. Before starting chat one of the user must send a dialog box(yes/no) to other user to know whether the other user is intrested to chat or is busy in chatting with some one.
I am unable to do so .Plz help me out to pass a dialog box to other pc and get response back and act accordingly.
code will be more preferable than links
Thanx in advance.
|
|
|
|
|
You're going to need a network communication between the PCs in the first place, with your code running on both PCs, in order to send voice between them. There's no way that I can write code on my computer, to send a dialog box to your computer, and return a result. Imagine if that were possible, how insecure the web would be ? You need to write code to pass the request, receive the request, show the message box, and send back the result. Code you wrote needs to be running on both computers.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Dear Experts,
I have two questions here, first, I wanna know how to make an autonumber on C sharp (textbox). I have selected max number from a field in the table but I do not know how to make the textbox becomes an autonumber (always +1 with the max number) when I load the form.
The second question, I have many forms in my small (homework) project. I open form2 from form1(form1 still actives), I add some text in form2 and I want to make form1 (ex: combox) refresh (vba calls requery) when I close form 2.
Thanks for reading the entire of this passage.
Visoth
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|
|
misCafe wrote: I have two questions here, first, I wanna know how to make an autonumber on C sharp (textbox). I have selected max number from a field in the table but I do not know how to make the textbox becomes an autonumber (always +1 with the max number) when I load the form.
There is absolutely no way to do this automatically - you will have to write your own control. The only logical way I can see to do this is to have a column to show numbers, not add text to the control.
misCafe wrote: The second question, I have many forms in my small (homework) project. I open form2 from form1(form1 still actives), I add some text in form2 and I want to make form1 (ex: combox) refresh (vba calls requery) when I close form 2.
When your call to ShowDialog ends, you still have the dialog object and you can access it's properties. So, just expose the values you need, and grab and use them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thank you so much for your explanation below.
Yours,
Visoth
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|
|
I am meeting a problem in sending SMS from Website, if you have code about it, send me please! thank for your helping! I hope you can help me, send me early, I am waiting it!
|
|
|
|
|
While you're waiting you can read this[^]
only two letters away from being an asset
|
|
|
|
|
1 - we have an ASP.NET forum
2 - there is NO code to send an SMS. Instead, you need to find a local SMS provider ( don't forget to make sure it works where your client's server is, and not just where you are ). Any decent SMS provider will cost money. Free ones tend to disappear.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I was under the impression that SMSs were just emails. You could send an SMS to any phone by sending an email to the phone number at the service provider's SMS domain. Somebody got a hold of my cell phone number and kept sending me SMS emails and pictures. I had to go to Verizon and have them block all messages that originate from an email server and not a cell phone. What's interesting to me is that they have a checkbox option on the accounts to do just that.
Don't blame me. I voted for Chuck Norris.
|
|
|
|
|
FyreWyrm wrote: I was under the impression that SMSs were just emails. You could send an SMS to any phone by sending an email to the phone number at the service provider's SMS domain.
That would be news to me. If that's the case, why are there commercial SMS services ? They generally provide a webservice you connect to, and then you pay for use.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
That works for some providers, but not all. It used to work on Orange, but now your emails just bounce
|
|
|
|
|
Hi everyone, I am trying to change windows title text programatically, but do not know how.
I am working on win form app. I want to change for example Form1 to X. How do I do it? not
manually through propertry window. application run time I want to change it.
thanks
|
|
|
|
|
In the necessary place in your Form1's code:
Text = "X";
this.Text = "X"; This is very basic stuff. You really should study a book and/or some online getting started tutorials before asking questions in a forum. We don't mind helping when you're stuck - but we're not pre-'coding school' teachers.
|
|
|
|
|
thanks dave ,
I could not figur it out anyway. do not know why.
as you know it can be trivial but tricky.
|
|
|
|
|
Well the property window tells you the property name, you know your Forms name, putting 2 and 2 together shouldn't be tricky. I would take Dave's advice and get a beginners book.
|
|
|
|
|
public static void getyn(ref Form org_form)
{
org_form.Enabled=False;
}
The simple method above illustrates how I can disable a form that has been instantiated elsewhere, using a reference parameter. If I instantiate a form "test_this", and in that code, I call this method above passing "test_this", this works. But now I want to access "test_this" or "org_form" (to me, they are the same for this issue) in another method (ie. org_form.Enabled=True;), such as within a button click event of another form. In that code, I do not know what name was used to instantiate the form. My thought would be to somehow create some public reference or pointer in this "getyn" method so that I can access this elsewhere. There must be some way to make "org_form" available/public so it can be accessed in other methods?
|
|
|
|
|
First of all, there is no need for the ref for your parameter. Form is a class and therefore passed by reference anyway.
Secondly, passing Forms around and making instances of them public to external classes is a BAD idea.
Ask yourself - what object owns what?
1. If the Form is owned by the other object, then when it creates the form it can store a reference to it for later use.
2. If the Form owns the other object , then the other object should raise events which the Form subscribes to after instanciation of the object.
3. If there is no direct relationship between the Form and the other object then I would recommend a 'manager' class that can instanciate the form and the other object, store references to them and subscribe to their events so it can handle communication between them.
Edit: A little diagram to show what I mean:
One and Two:
|---------------------------------------------------------------|
Parent V Child |
=================================== =================================== |
|-----------Subscriptions---------| |-----------Subscriptions---------| |
|Properties ============= Events | |-->|Properties ============= Events | >---|
|-----------| OBJECT |---------| | |-----------| OBJECT |---------|
|Methods ============= Call/Set| --|-->|Methods ============= Call/Set|
=================================== ===================================
Three:
|--------------------------------------------|
Manager V |
=================================== |
|-----------Subscriptions---------| |
|Properties ============= Events | |
|-----------| OBJECT |---------| |
|Methods ============= Call/Set| >---| |
=================================== | |
|---------------------------------------------|-------------------| |
| | |
| | |
| =================================== | =================================== |
| |-----------Subscriptions---------| | |-----------Subscriptions---------| |
|-->|Properties ============= Events | >--| |-->|Properties ============= Events | >--|
| |-----------| OBJECT |---------| | | |-----------| OBJECT |---------| |
|-->|Methods ============= Call/Set| | |-->|Methods ============= Call/Set| |
=================================== | =================================== |
|---------------------------------------------|
modified on Thursday, October 22, 2009 3:24 PM
|
|
|
|