How to copy a file from Client to Application Server

Hello,
My requirement is user selects a file from Browse button on oracle form - this location is on client side, and have to copy this file on Application server.
I tried using webutil_file.copy_file function but it gives error - copy_file is not a procedure or is undefined.
There is another way of Client_to_AS but it needs some changes in configuration files of webutil, which is not allowed in our scenario.
Source - client machine resident file
Target- Application server disk location
So can any one help in this regard?

Hi Francois,
Thanks for your suggestion, actually i didnt want to use Client_to_As as client doesnt want to make any changes in any configuration files, no matter how small the change is.
Anyways we are able to successfully copy the file using Client_to_AS, but one thing that i couldn't understand is why was our webutil_file.copy_file function failing?
Any hint about this?
Thanks!
Avinash.
Pune- India.

Similar Messages

  • How to move PDF file from Spool to Application Server?

    How to move PDF file from Spool to Application Server?
    Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
    RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
    The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.

    Hi Gemini ,
    Please refer the below links.
    [http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
    [http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
    Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM

  • Copy file from client PC to server in a web deployed application

    I have developed one application using Oracle forms 6i, which is deployed on the web server.
    I run this application from a client PC in Internet Explorer using internet.
    I want to copy one file from the client PC to the web server.
    I have done following things
    - Created a shared folder on the server and given full rights to every one on this folder
    - I use 'net use' command in my program to connect to this shared folder
    - I use copy command to copy file from local client pc to server. This copy command I am executing using host command of my programming (PL/SQL: eg. host('copy abc.txt \\server\share\') )
    But this does not work.
    When I do the same thing in command window, it works.
    (ie. Start-Run cmd to open command window and then type the above copy command)
    Can you please tell me, how to copy a file from client PC to the sever in Web deployed application?
    Thanks

    I downloaded D2KWUtil from the link suggested by you. It has very nice example demo form. But the documentation provided says following
    Using D2KWUTIL in Web Deployed Applications
    The use of this library is not supported with Web deployed applications.
    In a web deployment scenario not all functions within D2KWUTIL will work. Any function that interacts with the User Interface (such as those in the WIN_API_DIALOG package) will fail.
    Any interaction with the O/S by other functions will all be executed on the NT server and will act within, or return information pertinant to, the environment on that machine. For instance GET_COMPUTER_NAME will return the Server’s name, not the name of the computer that the Client browser is running on. Likewise COPY_FILE will copy files in the Forms Server not on the Client.
    Functions such as those in WIN_API_BITOP will continue to work without change.
    so this will not work in web deployed application.
    Any other suggestion?
    Thanks

  • Does anyone know how to copy my files from my ipod to a different computer?

    Does anyone know how to copy my files from my ipod to a different computer? I tried to do it, but all that it did was erase my files. What i want to to is use my ipod to transfer my files to another computer (which has itunes as well) PLEASE help!

    You will need to enable your iPod for disk use. Then, you should see your iPod in "My Computer" and you can open up your iPod's folder there and drag the files into it. You can store the files on the iPod, then connect it to the other computer and drag-and-drop them from the iPod into the designated directory in that computer. Make sure individual files are not larger than 4 GB.

  • How to copy pdf files from computer to ipad

    how to copy pdf files from computer to ipad

    You can PDFs to the iPad, but first you need one or more apps on the iPad that supports PDFs - unlike a 'normal' computer the iPad doesn't have a file system, and everything on it has to be associated with an app.
    Options include free apps such as Apple's iBooks app and also Adobe Reader - and paid-for apps such as GoodReader (which also supports read-only of other documents types).
    For iBooks you can first add the PDFs to your computer's iTunes via File > Add To Library, and you can then sync them by selecting the iPad on the left-hand sidebar of your computer's iTunes (on iTunes 11 you can enable the sidebar via option-command-S on a Mac, control-S on a PC) and using the Books tab on the right-hand side to select and sync them.
    For Adobe Reader adnd GoodReader you can use the file sharing on the Apps tab on the right-hand side to copy them over : http://support.apple.com/kb/ht4094

  • To upload a file from client machine to server machine

    Hi everybody!
    Could anyone plz help me. I am struck in a problem
    I want to transfer a file from client's machine to server but I am not able to upload
    It is tranferring the file only to the local machine
    I am using orielley package It is transferring files only to my local machine but not to the server .Can anyone correct it. It's very urgent
    how to write the relative path for server
    I am using this path and it is not uploading
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    Here is my code:
    <%@ page import="java.util.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="com.oreilly.servlet.MultipartRequest"%>
    <%
    try {
    // Blindly take it on faith this is a multipart/form-data request
    // Construct a MultipartRequest to help read the information.
    // Pass in the request, a directory to saves files to, and the
    // maximum POST size we should attempt to handle.
    // Here we (rudely) write to the server root and impose 5 Meg limit.
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    out.println("<HTML>");
    out.println("<HEAD><TITLE>UploadTest</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<H1>UploadTest</H1>");
    // Print the parameters we received
    out.println("<H3>Params:</H3>");
    out.println("<PRE>");
    Enumeration params = multi.getParameterNames();
    while (params.hasMoreElements()) {
    String name = (String)params.nextElement();
    String value = multi.getParameter(name);
    out.println(name + " = " + value);
    out.println("</PRE>");
    // Show which files we received
    out.println("<H3>Files:</H3>");
    out.println("<PRE>");
    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements()) {
    String name = (String)files.nextElement();
    String filename = multi.getFilesystemName(name);
    String type = multi.getContentType(name);
    File f = multi.getFile(name);
    out.println("name: " + name);
    out.println("filename: " + filename);
    out.println("type: " + type);
    if (f != null) {
    out.println("length: " + f.length());
    out.println();
    out.println("</PRE>");
    catch (Exception e) {
    out.println("<PRE>");
    out.println("</PRE>");
    out.println("</BODY></HTML>");
    %>

    you have not understood my point
    how does this code will run on servlet when I want to upload a file from client's
    machine to server machine
    what I am doing is I am giving an option to the user that he/she can browse the file and then select any file and finally it's action is post in the jsp form for which I have sent the code
    All the computers are connected in LAN
    So how to upload a file from client's machine to server's machine
    Plz give me a solution

  • How to send the file contents in the application server to ftp server

    Hi,
    how to send the file contents in the application server to ftp server.
    regards,
    sree

    Test SAP FTP functions
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
           HOST            = 'servername'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    do some error checking.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.
    Execute external commands (FTP Scripts)
    The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
    DATA: ld_comline 
    LIKE sxpgcolist-name,
            ld_param    LIKE sxpgcolist-parameters,
            ld_status   LIKE extcmdexex-status,
            ld_output   LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            ld_subrc    LIKE sy-subrc.
      REFRESH ld_output.
      MOVE 'FTP_DATA_IN' to ld_comline.         "Maintained using trans SM69
    Execute external command, contained in 'ld_comline'
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = ld_comline
              additional_parameters   = ld_param  "Params passed to script
              operatingsystem              
    = 'UNIX'
           IMPORTING
                status                        = ld_status
           TABLES
                exec_protocol                 = ld_output
           EXCEPTIONS
                no_permission
                     = 1
                command_not_found
                 = 2
                parameters_too_long          
    = 3
                security_risk                
    = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry
              = 13
                jobcount_generation_error
         = 14
                OTHERS                       
    = 15.
      IF sy-subrc NE 0.
      ENDIF.

  • How to copy a file from one folder to another folder in Linux

    Hello everyone,
    Oracle forms 11g 11.1.2.0.0
    OS: Oracle Linux
    We use webutil to upload files to the application server from the client machine, and stores them in a folder named JOB_DOCS on the application server (This folder is created as a databse directory too). File types are JPEG, GIF, PDF, TXT, BMP, DOC, XLS etc...
    At a later stage when the user tries to view the uploaded documents, this was not getting displayed on the screen
    on our windows server, when the user clicks on the print button we copy the file from the JOB_DOCS folder to the forms\java folder using the below command
    HOST('COPY ' ||d:\JOB_DOCS\test.pdf||' '||'c:\oracle\middleware\as\forms\java\test.pdf ,NO_SCREEN);
    once the file is under the forms\java folder then it is getting displayed on the screen to print or save, and later we remove the file from forms\java folder.
    But my problem here is, recently we have installed our application on Oracle Linux server, and we have JOB_DOCS folder there, and the users can upload files to this folder also. How can we copy the file test.pdf from JOB_DOCS to forms/java in linux?
    And what could be the reson for the document cannot be accessed from the folder where it is saved? We tried giving folder permissions, adding the folder to PATH variable etc.

    For copying and moving directories you can use the cp and mv commands just like you use them with files. Yeah, I know. If you've already tried to copy a directory with cp, you've probably noticed that cp just complains at you. Probably it says something like cp: omitting directory yadda yadda. You see, the cp command wants you to use the -r option if you want to copy a directory with its contents. The -r means "copy recursively":
    $ cp -r dir1 dir2
    The above creates a directory named dir2 whose contents will be identical to dir1. However, if dir2 already exists, nothing will be overwritten: the directory dir1 will be copied into the dir2 directory under the name dir2/dir1.
    When renaming directories, you use the mv command exactly the same way as with files:
    $ mv dir1 dir2
    When dealing with directories, mv works a bit like cp does. If dir2 doesn't exist, the above will rename dir1 to dir2, but if dir2 exists, the directory dir1 will be moved into the dir2 directory under the name dir2/dir1.
    ref http://www.tuxfiles.org/linuxhelp/dirman.html

  • How to copy a file from one location to another ???

    Hi,
    I have a file ('D:/Pictures/1.jpg') and I want to copy this 1.jpg file to a location called 'D:/Folder1'. I tried the WebUtil_File.copy_file function, but it does not work. it returns false boolean.
    I am using windows xp and oracle 10g.
    The webutil configurations are also completed.
    This D: drive is the one which has oracle 10g application server installed.
    Am I doing anything wrong or missed?. I need to complete this urgently. but it does not work.
    Or any other way to copy a file from one place to given any path?. After this I have to renaming (may be using Rename_File function) the copied file. Please advice me.

    An alternative could be HOST command, that calls OS prompt to run a command in the server and then return the focus to the Forms:
    HOST ('copy D:/Pictures/1.jpg D:/Folder1/1.jpg');
    Edited by: Kleber M on Sep 9, 2011 12:38 PM

  • How to copy a file from application server to local system

    Guys,
    Need to copy a file from application server to local system.Is there an FM for the same.
    Tried searching for it but couldn't find anything useful.
    Code snippets will be highly appreciated.
    Warm Regards,
    P.
    Moderator message: very frequently asked and answered question, obviously you did not search thoroughly, all points removed.
    Edited by: Thomas Zloch on Dec 3, 2010 4:48 PM

    hi,
    You can use the transactions CG3Y or through program u can do like this..
    DATA: BEGIN OF IT_FILE OCCURS 0,
                    LINE TYPE STRING,
               END OF IT_FILE.
    OPEN DATASET <file_name>  FOR INPUT IN TEXT MODE ENCODING DEFAULT.
            IF SY-SUBRC IS INITIAL.
              DO.
                READ DATASET<file_name> INTO IT_FILE-LINE.
                IF SY-SUBRC = 0.
                  APPEND IT_FILE.
                  CLEAR IT_FILE.
                ELSE.
                  EXIT.
                ENDIF.
              ENDDO.
            ENDIF.
    CLOSE DATASET <file_name>.
    Download it to local system using  FM - GUI_DOWNLOAD

  • How to copy a file from one PC to another in ABAP program

    Hello Friends,
    I have a requirement where I have to copy a file from a central location ( central servers like
    inblr102 or
    dwdf ) and save it on local PC in ABAP code. Also, while saving it should ask for the path on PC. Can any of you please help me in this?
    Thanks in advance!
    Divya

    Hi,
    Check out this link. This deletes file,  probally you will get some hint to copy.:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/deleting%252bfile%252bfrom%252bwindows
    Thanks,
    Krishna

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • How to list IP address from client on the Server (TCP/IP CLIENT SERVER COMMUNICATION)

    Excuse me,
    In this project I want to ask how to add list IP from client that connect to server.
    I have edited slightly the project.
    'SERVER
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.Threading
    Imports System.Threading.Tasks
    Imports System.Reflection
    Public Class ServerForm
    Private _Listener As TcpListener
    Private _Connections As New List(Of ConnectionInfo)
    Private _ConnectionMonitor As Task
    Private Sub Button_Checked(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
    If StartStopButton.Checked Then
    StartStopButton.Text = "Stop"
    StartStopButton.Image = My.Resources.StopServer
    _Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
    _Listener.Start()
    Dim monitor As New MonitorInfo(_Listener, _Connections)
    ListenForClient(monitor)
    _ConnectionMonitor = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskContinuationOptions.LongRunning)
    Else
    StartStopButton.Text = "Start:"
    StartStopButton.Image = My.Resources.StartServer
    CType(_ConnectionMonitor.AsyncState, MonitorInfo).Cancel = True
    _Listener.Stop()
    _Listener = Nothing
    End If
    End Sub
    Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
    Dim deltaPort As Integer
    If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
    MessageBox.Show("Port number between 1 and 65535", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    PortTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub ListenForClient(monitor As MonitorInfo)
    Dim info As New ConnectionInfo(monitor)
    _Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
    End Sub
    Private Sub DoAcceptClient(result As IAsyncResult)
    Dim monitorinfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
    If monitorinfo.Listener IsNot Nothing AndAlso Not monitorinfo.Cancel Then
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    monitorinfo.Connections.Add(info)
    info.AcceptClient(result)
    ListenForClient(monitorinfo)
    info.AwaitData()
    Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
    Invoke(doUpdateConnectionCountLabel)
    End If
    End Sub
    Private Sub DoMonitorConnections()
    Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
    Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
    Dim monitorInfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
    Me.Invoke(doAppendOutput, "Server Started")
    Do
    Dim lostCount As Integer = 0
    For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
    Dim info As ConnectionInfo = monitorInfo.Connections(index)
    If info.Client.Connected Then
    If info.DataQueue.Count > 0 Then
    Dim messageBytes As New List(Of Byte)
    While info.DataQueue.Count > 0
    Dim value As Byte
    If info.DataQueue.TryDequeue(value) Then
    messageBytes.Add(value)
    End If
    End While
    Me.Invoke(doAppendOutput, "Message from IP: " + System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
    End If
    Else
    monitorInfo.Connections.Remove(info)
    lostCount += 1
    End If
    Next
    If lostCount > 0 Then
    Invoke(doUpdateConnectionCountLabel)
    End If
    _ConnectionMonitor.Wait(1)
    Loop While Not monitorInfo.Cancel
    For Each info As ConnectionInfo In monitorInfo.Connections
    info.Client.Close()
    Next
    monitorInfo.Connections.Clear()
    Invoke(doUpdateConnectionCountLabel)
    Me.Invoke(doAppendOutput, "Server Stoped")
    End Sub
    Private Sub UpdateConnectionCountLabel()
    ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
    End Sub
    Private Sub AppendOutput(message As String)
    If RichTextBox1.TextLength > 0 Then
    RichTextBox1.AppendText(ControlChars.NewLine)
    End If
    RichTextBox1.AppendText(message)
    RichTextBox1.ScrollToCaret()
    End Sub
    Private Sub ClearButton_Checked(sender As Object, e As EventArgs) Handles ClearButton.CheckedChanged
    If ClearButton.Checked Then
    RichTextBox1.Clear()
    End If
    End Sub
    End Class
    Public Class MonitorInfo
    Private _listener As TcpListener
    Public ReadOnly Property Listener As TcpListener
    Get
    Return _listener
    End Get
    End Property
    Private _connections As List(Of ConnectionInfo)
    Public ReadOnly Property Connections As List(Of ConnectionInfo)
    Get
    Return _connections
    End Get
    End Property
    Public Property Cancel As Boolean
    Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
    _listener = tcpListener
    _connections = connectionInfoList
    End Sub
    End Class
    Public Class ConnectionInfo
    Private _monitor As MonitorInfo
    Public ReadOnly Property Monitor As MonitorInfo
    Get
    Return _monitor
    End Get
    End Property
    Private _Client As TcpClient
    Public ReadOnly Property Client As TcpClient
    Get
    Return _Client
    End Get
    End Property
    Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    Get
    Return _DataQueue
    End Get
    End Property
    Private _Stream As NetworkStream
    Public ReadOnly Property Stream As NetworkStream
    Get
    Return _Stream
    End Get
    End Property
    Public Sub New(monitor As MonitorInfo)
    _monitor = monitor
    _DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
    End Sub
    Private _LastReadLength As Integer
    Public ReadOnly Property LastReadLength As Integer
    Get
    Return _LastReadLength
    End Get
    End Property
    Private _Buffer(63) As Byte
    Public Sub AcceptClient(result As IAsyncResult)
    _Client = _monitor.Listener.EndAcceptTcpClient(result)
    If _Client IsNot Nothing AndAlso _Client.Connected Then
    _Stream = _Client.GetStream
    End If
    End Sub
    Public Sub AwaitData()
    _Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
    End Sub
    Private Sub DoReadData(result As IAsyncResult)
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    Try
    If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
    info._LastReadLength = info.Stream.EndRead(result)
    For Index As Integer = 0 To _LastReadLength - 1
    info._DataQueue.Enqueue(info._Buffer(Index))
    Next
    'info.SendMessage("Data Diterima " & info._LastReadLength & " Bytes")
    info.SendMessage("reply form server: " & info._LastReadLength & " Bytes")
    For Each otherInfo As ConnectionInfo In info.Monitor.Connections
    If Not otherInfo Is info Then
    otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
    End If
    Next
    info.AwaitData()
    Else
    info.Client.Close()
    End If
    Catch ex As Exception
    info._LastReadLength = -1
    End Try
    End Sub
    Private Sub SendMessage(message As String)
    If _Stream IsNot Nothing Then
    Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
    Stream.Write(messageData, 0, messageData.Length)
    End If
    End Sub
    End Class
    'CLIENT
    Imports System.Net
    Imports System.Net.Sockets
    Public Class ClientForm
    Private _Connection As ConnectionInfo
    Private _ServerAddress As IPAddress
    Private Sub ClientForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    ValidateChildren()
    End Sub
    Private Sub ConnectButton_Checked(sender As Object, e As System.EventArgs) Handles ConnectButton.CheckedChanged
    If ConnectButton.Checked Then
    If _ServerAddress IsNot Nothing Then
    ConnectButton.Text = "Disconnect"
    ConnectButton.Image = My.Resources.StopServer
    Try
    _Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
    _Connection.AwaitData()
    Catch ex As Exception
    MessageBox.Show(ex.Message, "Error Connecting to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    ConnectButton.Checked = False
    End Try
    Else
    MessageBox.Show("Invlid IP Server", "Cannt Connect to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    ConnectButton.Checked = False
    End If
    Else
    ConnectButton.Text = "Connect"
    ConnectButton.Image = My.Resources.StartServer
    If _Connection IsNot Nothing Then _Connection.Close()
    _Connection = Nothing
    End If
    End Sub
    Private Sub SendButton_Click(sender As System.Object, e As System.EventArgs) Handles SendButton.Click
    If _Connection IsNot Nothing AndAlso _Connection.Client.Connected AndAlso _Connection.Stream IsNot Nothing Then
    Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(InputTextBox.Text)
    _Connection.Stream.Write(buffer, 0, buffer.Length)
    End If
    End Sub
    Private Sub ServerTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles IPTextBox.Validating
    _ServerAddress = Nothing
    Dim remoteHost As IPHostEntry = Dns.GetHostEntry(IPTextBox.Text)
    If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
    For Each deltaAddress As IPAddress In remoteHost.AddressList
    If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
    _ServerAddress = deltaAddress
    Exit For
    End If
    Next
    End If
    If _ServerAddress Is Nothing Then
    MessageBox.Show("Cannot resolve Server Address", "invalid Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    IPTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
    Dim deltaPort As Integer
    If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
    MessageBox.Show("Port number between 1 and 65535", "invalid Port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    PortTextBox.SelectAll()
    e.Cancel = True
    End If
    End Sub
    Private Sub InvokeAppendOutput(message As String)
    Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
    Me.Invoke(doAppendOutput, message)
    End Sub
    Private Sub AppendOutput(message As String)
    If RichTextBox1.TextLength > 0 Then
    RichTextBox1.AppendText(ControlChars.NewLine)
    End If
    RichTextBox1.AppendText(message)
    RichTextBox1.ScrollToCaret()
    End Sub
    Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
    RichTextBox1.Clear()
    InputTextBox.Clear()
    End Sub
    End Class
    Public Class ConnectionInfo
    Private _AppendMethod As Action(Of String)
    Public ReadOnly Property AppendMethod As Action(Of String)
    Get
    Return _AppendMethod
    End Get
    End Property
    Private _Client As TcpClient
    Public ReadOnly Property Client As TcpClient
    Get
    Return _Client
    End Get
    End Property
    Private _Stream As NetworkStream
    Public ReadOnly Property Stream As NetworkStream
    Get
    Return _Stream
    End Get
    End Property
    Private _LastReadLength As Integer
    Public ReadOnly Property LastReadLength As Integer
    Get
    Return _LastReadLength
    End Get
    End Property
    Private _Buffer(63) As Byte
    Public Sub New(address As IPAddress, port As Integer, append As Action(Of String))
    _AppendMethod = append
    _Client = New TcpClient
    _Client.Connect(address, port)
    _Stream = _Client.GetStream
    End Sub
    Public Sub AwaitData()
    _Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoreadData, Me)
    End Sub
    Public Sub Close()
    If _Client IsNot Nothing Then _Client.Close()
    _Client = Nothing
    _Stream = Nothing
    End Sub
    Private Sub DoreadData(result As IAsyncResult)
    Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
    Try
    If info._Stream IsNot Nothing AndAlso info._Stream.CanRead Then
    info._LastReadLength = info._Stream.EndRead(result)
    If info._LastReadLength > 0 Then
    Dim message As String = System.Text.Encoding.ASCII.GetString(info._Buffer)
    info._AppendMethod(message)
    End If
    info.AwaitData()
    End If
    Catch ex As Exception
    info._LastReadLength = -1
    info._AppendMethod(ex.Message)
    End Try
    End Sub
    End Class
    //ScreenShot server
    http://prntscr[dot]com/5t1ol3
    //Screenshot client
    http://prntscr[dot]com/5t1odj
    source: code[dot]msdn[dot]microsoft[dot]com/windowsdesktop/Simple-Multi-User-TCPIP-43cc3b44

    I have a similar chat application. When the user attempts to connect, instead of sending a simple string, the client sends a serialized object(xml string) with all relevant login and session information, this includes the user's IP address. Once the server
    receives said information, depending on the type of TCP broadcast (a custom enumerated type) information from one user may be passed to a single user, or distributed to many users.
    If it helps, here is the TCPBroadcast object I use. But in order for your server to understand it, you kind of have to build your server and client somewhat around it.
    Option Strict On
    Option Explicit On
    Option Infer Off
    Namespace TCPChat
    Public Class TCPBroadcast
    Public Property Message As String
    Public Property BroadCastTime As DateTime
    Public Property DestUser As String
    Public Property OriginUser As String
    Public Property PasswordHash As String
    Public Property BroadcastSourceIP As String
    Public Property BroadCastType As TCPBroadcastType
    Public Property LoginUserName As String
    Public Property FailureReason As String
    Public Function XmlEncoding() As String
    Dim serializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
    Dim XML As String = String.Empty
    Using memStream As New IO.MemoryStream
    Using xmlWriter As New Xml.XmlTextWriter(memStream, System.Text.Encoding.UTF8) With _
    {.Indentation = 4, .Formatting = System.Xml.Formatting.Indented}
    serializer.Serialize(xmlWriter, Me)
    End Using
    XML = System.Text.Encoding.UTF8.GetString(memStream.ToArray)
    End Using
    Return XML
    End Function
    Public Function ToBinary() As Byte()
    Return System.Text.Encoding.UTF8.GetBytes(Me.XmlEncoding)
    End Function
    Public Shared Function FromBinary(binary As Byte()) As DeserializationResult
    Dim xml As String = System.Text.Encoding.UTF8.GetString(binary)
    Return FromXML(xml)
    End Function
    Public Shared Function FromXML(xml As String) As DeserializationResult
    Dim DeserializationResult As New DeserializationResult
    DeserializationResult.Error = False
    Try
    Dim deserializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
    Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(xml)
    Using memStream As New IO.MemoryStream(buffer)
    DeserializationResult.tcpBroadCast = CType(deserializer.Deserialize(memStream), TCPBroadcast)
    End Using
    Catch ex As Exception
    DeserializationResult.Error = True
    DeserializationResult.ErrorMessage = ex.ToString
    DeserializationResult.AttemptedXML = xml
    End Try
    Return DeserializationResult
    End Function
    Public Class DeserializationResult
    Public [Error] As Boolean
    Public ErrorMessage As String
    Public tcpBroadCast As TCPBroadcast
    Public AttemptedXML As String
    Sub New()
    End Sub
    End Class
    Public Enum TCPBroadcastType
    AdministrativeMessage
    AuthenticationFailure
    AuthenticationSuccess
    ChatBroadcast
    CredentialsRequest
    Credentials
    DisconnectedByServer
    KeepAlive
    PrivateMessage
    ServerMessage
    SystemMessage
    UnableToProcessRequest
    End Enum
    End Class
    End Namespace
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

  • How do I transfer files from my AIX database server to my Windows AS?

    Hello, I need to transfer log files from my AIX database server to my Windows AS so I can view them in a form. Any ideas??
    Regards

    Install samba with the samba client (smbclient). Push them via the smbclient directly to you Windows machine OR the other way around, start the samba deamons (smbd and nmbd). Make a Windows network share on your AIX machine and view them in your form directly.
    If you can't use samba then an alternative is the use of NFS

  • How to FTP a file from client machine to database server using forms 10g

    Hi
    I want to ftp a file from a client machine to the database server machine using forms 10G (or PL/SQL).
    could you please tell me how can I do this
    Regards

    hi
    How to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
    Solution
    Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
    here are steps to get a small test form running, using WebUtil 1.06.
    Note: Oracle_Home is used as an alias for your real oDS ORACLE_HOME.
    Feel free to copy this note to a text editor, and do a global find/replace on
    Oracle_Home with your actual value (no trailing slash). Then it is easy to
    copy/paste actual commands to be executed from the note copy.
    1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
    and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
    2) Copy or move jacob.jar and jacob.dll
    C:\webutile is the folder where you extracted Jacob, and will end in ...\jacob_18
    cd C:\webutile
    copy jacob.jar Oracle_Home\forms\java\.
    copy jacob.dll Oracle_Home\forms\webutil\.
    The Jacob staging area is no longer needed, and may be deleted.
    3) Sign frmwebutil.jar and jacob.jar
    Open a DOS command prompt.
    Add Oracle_Home\jdk\bin to the PATH:
    set PATH=Oracle_Home\jdk\bin;%PATH%
    Sign the files, and check the output for success:
    Oracle_Home\forms\webutil\sign_webutil Oracle_Home\forms\java\frmwebutil.jar
    Oracle_Home\forms\webutil\sign_webutil Oracle_Home\forms\java\jacob.jar
    4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
    you may skip this step. Otherwise,
    Create a schema to hold the WebUtil stored code, and privileges needed to
    connect and create a stored package. Schema name "WEBUTIL" is recommended
    for no reason other than consistency over the user base.
    Open Oracle_Home\forms\create_webutil_db.sql in a text editor, and delete or comment
    out the EXIT statement, to be able to see whether the objects were created witout
    errors.
    Start SQL*Plus as SYSTEM, and issue:
    CREATE USER webutil IDENTIFIED BY [password]
    DEFAULT TABLESPACE users
    TEMPORARY TABLESPACE temp;
    GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
    CONNECT webutil/webutil@rcci
    @Oracle_Home\forms\create_webutil_db.sql
    -- Inspect SQL*Plus output for errors, and then
    CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
    Reconnect as SYSTEM, and issue:
    grant execute on webutil_db to public;
    5) Modify Oracle_Home\forms\server\default.env, and append Oracle_Home\jdk\jre\lib\rt.jar
    to the CLASSPATH entry.
    6) Modify Oracle_Home\forms\server\formsweb.cfg insde [default] add :
    archive_jini=frmall_jinit.jar,frmwebutil.jar,jacob.jar
    archive=frmall.jar
    also add :
    [webutil]
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    baseHTMLjinitiator=webutiljini.htm
    baseHTMLjpi=webutiljpi.htm
    baseHTML=webutilbase.htm
    archive_jini=frmall_jinit.jar
    WebUtilArchive=frmwebutil.jar,jacob.jar,f90all.jar
    archive=frmwebutil.jar,f90all.jar
    lookAndFeel=oracle
    7) Modify Oracle_Home\forms\server\webutil.cfg and add :
    transfer.database.enabled=TRUE
    transfer.appsrv.enabled=TRUE
    8) Start the OC4J instance
    9) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
    Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
    It is important to generate the PLX, to avoid the FRM-40039 discussed in Note 303682.1
    If the PLX is not generated, the Webutil.pll library would have to be attached with
    full path information to all forms wishing to use WebUtil. This is NOT recommended.
    10) Create a new FMB.
    Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
    There is no need to Subclass the WebutilConfig object.
    Attach the Webutil.pll Library, and remove the path.
    Add an ON-LOGON trigger with the code
    NULL;
    to avoid having to connect to an RDBMS (optional).
    Create a new button on a new canvas, with the code
    show_webutil_information (TRUE);
    in a WHEN-BUTTON-PRESSED trigger.
    Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
    11) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
    the "Application Server URL" is empty.
    Then append "?config=webutil" at the end, so you end up with a URL of the form
    http://server:port/forms/frmservlet?config=webutil
    12) Run your form.

Maybe you are looking for