|
|
But is there a different between a chatting application and a sending of data application? Because what i looking for is send of data.
|
|
|
|
|
Text is data, you are sending bytes of information from a client to a server which is destributed to all connected clients.
I think it is exactly what you are looking for. If it isn't, google[^] will still help you better then anyone here can/will.
|
|
|
|
|
|
Sorry to disturb again.. For the link u pass me.. Is it possible for the server to reply to the client? Because for the current project it is not possible.
|
|
|
|
|
Using delegates and events it is possible
|
|
|
|
|
But there isn't any code inside the server that allow reply right? So can u advise where can i go and find the reply source code and construct a delegate?
|
|
|
|
|
I don't understand what you mean, "that allow reply". The server code has events inside it to notify the clients of new messages, and to update their view. Everything should be inside there and you're not going to get any much better as an example then that.
|
|
|
|
|
Ya i know what u mean. Create a delegate and when a event is raise run the delegate right? But for the server part i didnt notice any code which allows reply. Can u tell me which part of the code do a reply? They do not have any stream.write on the server side..
|
|
|
|
|
Dude, did you even READ[^] the bloody website? It says, and I quote
http://vb.net-informations.com/communications/vb.net_chat_server.htm wrote: When a Chat Client connected to Server , the Server create a new Thread for communication . Here we implement a Class handleClient for handling Client as a separate Thread . The Class handleClient has a function doChat() is handling the communication between the Server side Client Socket and the incoming Client Socket.
READ it and analyze the code better. Look at the broadcast method to see how it sends a message to users that a new connection has been established. If you can't figure it out with all that's layed out in front of you then you won't be able to do it at all.
|
|
|
|
|
I already edited on the code i have and the server do reply to its client but somehow the reply was not the expect result. Somehow the 1st request and reply are correct but the 2nd request and reply onward the application skip the 1st 2 letter of wat i type. I dont understand which part have i gone wrong. I have posted my code, pls advise on my mistake. Thanks a lot.
Private Sub doChat()
Dim infiniteCounter As Integer
Dim requestCount As Integer
Dim bytesFrom(10024) As Byte
Dim dataFromClient, DataToClient As String
Dim sendBytes As [Byte]()
Dim serverResponse As String
Dim rCount As String
requestCount = 0
For infiniteCounter = 1 To 2
infiniteCounter = 1
Try
requestCount = requestCount + 1
Dim networkStream As NetworkStream = _
clientSocket.GetStream()
networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
dataFromClient = System.Text.Encoding.ASCII.GetString(bytesFrom)
dataFromClient = _
dataFromClient.Substring(0, dataFromClient.IndexOf("$"))
msg("From client - " + clNo + " : " + dataFromClient)
rCount = Convert.ToString(requestCount)
serverResponse = "ok"
sendBytes = System.Text.Encoding.ASCII.GetBytes(serverResponse)
networkStream.Write(bytesFrom, 0, serverResponse.Length)
msg("From Server - " + serverResponse)
DataToClient = networkStream.Read(sendBytes, 0, sendBytes.Length)
broadcast(dataFromClient, clNo, True)
broadcast(serverResponse, "Server", True)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next
End Sub
|
|
|
|
|
Sorry Can't help you, I don't have the time to audit your code right now. Debug it and you'll find the error.
|
|
|
|
|
In a VB.NET application I have changed the roaming property of an user setting from false to true.
If I run the application the setting is now written (through my.settings.save) to the roaming user.config, but if I restart the application the setting is still being read from the local user.config !
Only if I delete the entry (manually) from the local user.config, then the setting is being read from the roaming user.config.
Somewhere in MSDN I read that if there were duplicate settings in local and roaming, the roaming one should override the local; in my case this seems only true for the writing of the setting.
Is this "bug" Microsoft's or mine ?
|
|
|
|
|
I'm looking for an example of how to obtain the two colors used in the gradient to the left (where the icons are) in the .NET style menus. I've tried to figure this out using the APIs for uxtheme.dll, but as I'm quite new to this it doesn't make much sense to me.
|
|
|
|
|
.NET menus are slightly different than standard operating system menus. The paint routines can be handled by the operating system or by the application itself. As for custom painting and determining menu renderers for menus, please look at my article: Custom ToolStrip Renderers[^]. As for uxtheme.dll ThemeAPI manipulation, please look into my other article: Adding Transparent Menus and Custom Titlebar Buttons to your Applications[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi
What is the equivalent of the following code in vb.net. If you give me a push, I would really appreciate it.
internal static class NativeMethods
{
[DllImport("coredll.dll")]
public static extern uint SendMessage(IntPtr hwnd, uint msg, uint wparam, uint lparam);
}
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
First that looks like C# code and not C code
Second there are alot of free convertors on the net
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
is one of them
And this is what you get if you use that one:
Friend Module NativeMethods
Private Sub New()
End Sub
<dllimport("coredll.dll")> _
Public Function SendMessage(ByVal hwnd As IntPtr, ByVal msg As UInteger, _
ByVal wparam As UInteger, ByVal lparam As UInteger) As UInteger
End Function
End Module
|
|
|
|
|
|
Are saying abt Module???
1.You can use global variable then u can retrieve the value
2.return the value from module function or sub.
|
|
|
|
|
I want use properties or global variables, but i don't understand how i do
Dim s as String
if ModalForm.ShowDialog=mrOk then
p=ModalForm.property_name
end if
Please,give me sample
|
|
|
|
|
actually I m not understand problem
1. what is P. is it integer variable or a control or something else
2. Why are using s.
This is my guess try it.
p=ModalForm.property_name
p contain an integer value. if want know that value use msgbox and check it.
If u want use outside other function the p variable make it as public. or give public variable scope. then u can use.
Until ur giving clear view of ur problem i can't give solution.
|
|
|
|
|
1. what is P. is it integer variable or a control or something else
Dim p as String
|
|
|
|
|
If you don't know anything, don't try to help people, it just confuses them.
A modal form is one that takes over the focus for the app, as in when you call ShowDialog
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanx's I don't know this concept. I wil learn I m new to vb.net just 2 months is over plzzz sorry for wrong ans.
|
|
|
|
|
All you have to do is expose the return values as public properties on your modal Form. Set those properties when the user clicks on the OK button.
When control passes back to the code that shown the form, you just pickup the values from those properties.
|
|
|
|