|
Hello!
I have created a pretty cool application that works in the office environment, it allows for people to pass text, files and voice chat between each other. Its much like the Yahoo chat or those types of apps but allows you to select several people and simultaneously send encoded data. You can see the app here:
http://www.umbrasystems.com/gcomm.php
The way it works is; there is a server who sits listening on a port, the chat clients connect to that server. As chat clients connect, the server gives a list of the other connected chat clients, and informs the existing chat clients of the newcomer, so all clients now have each others names and IP addresses. When the user(chat client) wants to send a message to one or more users, he selects them from the interface and sends the data. The data is sent P2P because each chat client has its own listening server which the sender connects to to send the data, be it text or file or whatever.
This application system works great in a LAN environment but if there is a chat client outside, lets say the boss is at home but still wants to talk to the employees, he/she can't make a P2P connection to any of the others inside the LAN. This is assuming the boss can at least connect to the server(which may sit on the outside). The way I have it now is if the P2P can not be established then all data is routed through the host.
My question is this:
Assuming all chat clients have a connection to the server, how do I make a P2P connection to other chat clients on other LANs? How do other applications like Skype or Yahoo make that connection??? (and without having to port forward). I'm sure that Skype and Yahoo messenger connect to a common server initially as well.
In my server I can see that there are 2 connections, bill and Tom, who's addresses are the same 66.75.225.55:3045 and 66.75.225.55:4033, but the server has communication with them on different ports established by their LAN's router's NAT table. Is it feasible for the chat client 'Pat', who is on a different LAN, to use the address and port established by the host to directly send data?
I would appreciate any insight on how this is done!!
|
|
|
|
|
I have the same question.And there are no good answers to this question by Intenet searching.I hope who have solved this give the answer.
|
|
|
|
|
I have not really found a solution to the question but if you do a search on Rendezvous servers you can get an idea on how some of the professional applications solve this problem. Currently if the applications can't make a point-to-point connection then I just route all data through the host.
|
|
|
|
|
Has anyone used the Office View Component (http://www.ocxt.com) and had a problem with it not setting the Different First Page Header setting even though it is set in the underlying document?
|
|
|
|
|
In C# I need to serialize a List of Constraint objects. Each Constraint has a Group, Field, Condition, and some values depending on the CGF combination. I have been trying to get these serialized so that I can store them, preferably in an ASP.NET cookie. I cannot use Session to maintain the list because I was told we have 2 web servers and Session won't work, so I need to serialize the CList and push it off in a cookie...I'm new to ASP.NET, but I thought skilled in C# and started working on a test app to serialize a List of generic objects based on a sample app here but it is not working properly.
In this example I make a List and add to it a few employees, then try to serialize it and store off in a file. Reset my List and such, then open the file a read the serialized data back to the List.
When using the original project, one employee at a time worked. The original is here: http://www.codeproject.com/KB/cs/objserial.aspx
using System;<br />
using System.IO;<br />
using System.Runtime.Serialization;<br />
using System.Runtime.Serialization.Formatters.Binary;<br />
using System.Collections.Generic;<br />
<br />
namespace MyObjSerial<br />
{<br />
[Serializable()]
public class Employee : ISerializable<br />
{<br />
public int EmpId;<br />
public string EmpName;<br />
<br />
public Employee()<br />
{<br />
EmpId = 0;<br />
EmpName = null;<br />
}<br />
<br />
public Employee(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
EmpId = (int)info.GetValue("EmployeeId", typeof(int));<br />
EmpName = (String)info.GetValue("EmployeeName", typeof(string));<br />
}<br />
<br />
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
info.AddValue("EmployeeId", EmpId);<br />
info.AddValue("EmployeeName", EmpName);<br />
}<br />
}<br />
<br />
public class ObjSerial<br />
{<br />
public static void Main(String[] args)<br />
{<br />
List<Employee> mp = new List<Employee>();<br />
Employee e = new Employee();<br />
e.EmpId = 10;<br />
e.EmpName = "Omkumar";<br />
mp.Add(e);<br />
e.EmpId = 11;<br />
e.EmpName = "this";<br />
mp.Add(e);<br />
e.EmpId = 12;<br />
e.EmpName = "is a";<br />
mp.Add(e);<br />
e.EmpId = 13;<br />
e.EmpName = "test";<br />
mp.Add(e);<br />
<br />
mp.Add(e);<br />
<br />
Stream ostream = File.Open("EmployeeInfo.osl", FileMode.Create);<br />
BinaryFormatter bformatter = new BinaryFormatter();<br />
<br />
Console.WriteLine("Writing Employee Information");<br />
bformatter.Serialize(ostream, mp);<br />
ostream.Close();<br />
<br />
mp = null;<br />
bformatter = null;<br />
<br />
Stream istream = File.Open("EmployeeInfo.osl", FileMode.Open);<br />
bformatter = new BinaryFormatter();<br />
<br />
Console.WriteLine("Reading Employee Information");<br />
mp = (List<Employee>)bformatter.Deserialize(istream);<br />
istream.Close();<br />
foreach (Employee f in mp)<br />
{<br />
Console.WriteLine("Employee Id: {0}", f.EmpId.ToString());<br />
Console.WriteLine("Employee Name: {0}", f.EmpName);<br />
}<br />
<br />
}<br />
}<br />
}<br />
Thanks for any help you might give.
jrk
|
|
|
|
|
godfetish wrote: .I'm new to ASP.NET
And I know zilch about it.
I'll bet there are a lot of people over in the ASP.NET Forum that do though.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Don't expect the help with ASP.NET, asked for help with serializing a List in C#, but thanks for reading the first sentance.
|
|
|
|
|
Sorry about that. My eyes are tired, that's my excuse, and I'm sticking to it.
solution:
public static void Main(String[] args)
{
List<Employee> mp = new List<Employee>();
Employee e = new Employee();
e.EmpId = 10;
e.EmpName = "Omkumar";
mp.Add(e);
e = new Employee();
e.EmpId = 11;
e.EmpName = "this";
mp.Add(e);
e = new Employee();
e.EmpId = 12;
e.EmpName = "is a";
mp.Add(e);
e = new Employee();
e.EmpId = 13;
e.EmpName = "test";
mp.Add(e);
mp.Add(e);
You do realise you will get two 13 employees, because of the last line.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
The output of the sample project is:
Writing Employee Information<br />
Reading Employee Information<br />
Employee Id: 13<br />
Employee Name: test<br />
Employee Id: 13<br />
Employee Name: test<br />
Employee Id: 13<br />
Employee Name: test<br />
Employee Id: 13<br />
Employee Name: test<br />
Employee Id: 13<br />
Employee Name: test<br />
Press any key to continue . . .
So, yes, two EId's of 13 should be there, by design or by fault...not 5 of them when deserialized.
I see that the de/serialization is only calling the get/set in the class object one time each way. Not 5 times, once for each record! This is an interesting problem...
|
|
|
|
|
I copied your code to a new Console Application and ran it. I got the result that you have just posted. Then I made the modifications, as in my previous post, and I got:
Writing Employee Information
Reading Employee Information
Employee Id: 10
Employee Name: Omkumar
Employee Id: 11
Employee Name: this
Employee Id: 12
Employee Name: is a
Employee Id: 13
Employee Name: test
Employee Id: 13
Employee Name: test
BTW When you post code snippets, if you are currently highlighting your code and then clicking on the 'inline code' widget (immediately above the text entry box) would you please use the 'code block' widget next to it. (explanation follows)
If on the other hand, you are typing in your 'code' tags could you please use 'pre' in place of 'code'.
EXPLANATION:
The 'code' tags give the horrible red and blue code colouration, which is very hard on the eyes and is one of the reasons I didn't read all of your original post. I'm being serious here, it actually makes my eyes hurt, and I know that applies to other CP members as well.
The 'pre' tags give much more restful colouring and what's more it preserves the formatting (well mostly) of your code, making it much easier to read.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You are right! Thanks Henry.
jrk
|
|
|
|
|
Pleasure!
Sorry again, for the misunderstanding.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I'm using a cascading dropdownlist using three tables. the code below works fine if my primary keys are numeric(integer) but my business rules want the primary keys to be alphernumeric(string).
[WebMethod]
public CascadingDropDownNameValue[] GetColors(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int colorId;
if (!kv.ContainsKey("Model") || !Int32.TryParse(kv["Model"],out colorId))
{
return null;
}
dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter();
dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in colors)
{
values.Add(new CascadingDropDownNameValue((string)dr["ColorName"], dr["ColorID"].ToString()));
}
return values.ToArray();
}
How do I use my string primary key using the above code?
Please help an ajax technology adict.
ML Lingwati
|
|
|
|
|
You are aware that we have both 'Web Development' and 'ASP.NET' Forums?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
I am trying to print a string that has alot of HTML tags in it. When I make use of the HTML visualizer, I can see that the output is correct. But how can I print it without showing the HTML tags, and only the correct format / output.
Many thanks in advance
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Set that string to a web browser control and call Print() method on that.
|
|
|
|
|
Thanks for the response. This can only be done in a WinForms applicaiton and not in ASP.NET
Something like this then:
using (WebBrowser b = new WebBrowser())
{
b.Navigate("about:blank");
b.Document.Title = pageTitle;
b.Document.Write(pageContent);
b.ShowPageSetupDialog();
b.ShowPrintPreviewDialog();
b.ShowPrintDialog();
}
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Well, do you want to do this in a windows/web application? Since you posted this on C# forum, I assumed you are on a windows application. If it is ASP.NET, you assign the string to a literal control and write the JS window.print() to the page using ClientScriptManager.RegisterClientScript() method. This will force the browser to display a print dialog box.
|
|
|
|
|
Hello
Is there any way to change the type of a column in a binded datagridview
I set the datasource of a datagridview from a datatable
This datatable contain two column needed for my purpose : an id and a text
I have another table Fruit
Each Fruit have an Id and A text
Of course I can also bind that table to a ComboBox
At run time in the DGV I need to show a column whith the fruit related to each row but I need to be able to get a combo cell on that column to chose another fruit from the fruit table
Is it possible ?
How can I do that
Thank for any help
|
|
|
|
|
We had to update the 3rd party application to allow null values for the specific enum fields. Flushed the mid-tier cache, updated the web reference in VS, updated the code to allow null (Incident_WS.StatusType? Status;) and it works.
-----
I'm trying to retrieve information from a web service. Some of the output parameters are enums and do not have a value in the database. How can I handle a null value in the code? I'm using C# 2008 with the 2.0 framework, if needed I can use a newer framework.
My example code (the actual web service has 9 enums):
Incident_WS.Incident_WSService ws = new Incident_WS.Incident_WSService();
Incident_WS.AuthenticationInfo auth = new Incident_WS.AuthenticationInfo();
auth.userName = "TEST";
auth.password = "WS_TEST";
ws.AuthenticationInfoValue = auth;
string Incident_Number = "INC000000007371";
Incident_WS.StatusType Status;
ws.HelpDesk_Query_Service(Incident_Number, out Status);
From the web service:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3053")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:HPD_IncidentInterface_WS")]
public enum StatusType {
New,
Assigned,
[System.Xml.Serialization.XmlEnumAttribute("In Progress")]
InProgress,
Pending,
Resolved,
Closed,
Cancelled,
}
Thanks in advance!
modified on Wednesday, August 26, 2009 11:54 AM
|
|
|
|
|
How about adding a new item to the enum something like None ?
public enum StatusType {
New,
Assigned,
[System.Xml.Serialization.XmlEnumAttribute("In Progress")]
InProgress,
Pending,
Resolved,
Closed,
Cancelled,
None
} If there is no value, just set StatusType.None .
|
|
|
|
|
We're connecting to a 3rd party database (BMC Remedy) and do not have the option to adding None to the list. A blank value is valid in the client. I don't know why there is not a blank option in the enum.
|
|
|
|
|
Good morning guys,
I need to write a program to validate the field values of several tables, and report which values don't comply with the validation.
So, let us suppose we need to validate only one field per each table.
The main procedure fetches all rows for that specific table/field, and calls a "validation function" to validate if that particular field for that table is valid.
We can end up with several validation functions which is OK since each validation is unique, but once I compiled the program, how can we plug a new validation functions to it?
The program will basically ask for 2 parameters: the table name and field name to validate, but how can we inject the "validation function" dynamically?
Open to ideas, suggestions
Thanks,
...Alex
|
|
|
|
|
Well, that's a plugin / extensibility question, if I'm not mistaken!
How about you use MEF[^] then?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Thanks for your prompt reply. I guess it is considered an extension/plugin; however, MEF is still in development according to the MEF site.
I guess I'd end up adding new validation functions and recompiling every time 
|
|
|
|